Page 1 of 2

Attachments

Posted: Wed Jul 07, 2010 8:43 am
by JonnyEQ
Script URL: http://Internal IP/CASHS_HELPDESK
Version of script: 2.2
Hosting company: ME
URL of phpinfo.php: http://Internal IP/CASHS_HELPDESK/phpinfo.php
URL of session_test.php: http://Internal IP/CASHS_HELPDESK/session_test.php
What terms did you try when SEARCHING for a solution: Attachments

Write your message below:

Ok, we have a problem with adding attachments. This worked fine before the upgrade. I have searched the knowledgebase and also followed the instructions of the sticky.

The error message I get when wanting to attach a file is.

'Cannot move file to the attachments folder, please check your server path settings'

I used the path.php and entered the settings in Hesk.

I have also changed the security permissions in the attachments folder and the the file hesk_settings.inc.php.

I followed the instructions to the book. I don't really want to revert to the back up as yet as I'm sure someone might be able to help me.

Thank You

Posted: Wed Jul 07, 2010 3:09 pm
by Klemen
Unfortunately we can't be of much help unless you provide the information you were asked for (both in this and the other topic you opened):

Script URL:
URL of phpinfo.php:

You will find phpinfo file in the "READ THIS BEFORE POSTING" topic.

Posted: Thu Jul 08, 2010 12:47 pm
by JonnyEQ
Sorry about lack of info. Hope this helps.

Posted: Thu Jul 08, 2010 3:20 pm
by Klemen
You will need to change "http://x.x.x.x" with an actual IP address or domain, so we can see the results :wink:

Posted: Mon Jul 12, 2010 8:59 am
by JonnyEQ
Klemen wrote:Unfortunately we can't be of much help unless you provide the information you were asked for (both in this and the other topic you opened):

Script URL:
URL of phpinfo.php:

You will find phpinfo file in the "READ THIS BEFORE POSTING" topic.
Hi Klemen, it's hosted internally on our intranet. Sorry.

Posted: Wed Jul 14, 2010 10:44 am
by Klemen
Can you let me know what you entered for the server path?

If you use Windows IIS also read this:
viewtopic.php?t=1406

Posted: Wed Jul 14, 2010 11:56 am
by JonnyEQ
Klemen wrote:Can you let me know what you entered for the server path?

If you use Windows IIS also read this:
viewtopic.php?t=1406
Hi Klemen, I already checked the link and everything is fine regarding the permissions.

The server path is: C:/wamp/www/Cashs_HELPDESK

Posted: Wed Jul 14, 2010 2:54 pm
by Klemen
I definitely need more info about the error then. Try this:
- backup your hesk_settings.php file
- manually edit the hesk_settings.php file: open it in Notepad and change

Code: Select all

if ($hesk_settings['debug_mode'])
{
    error_reporting(E_ALL ^ E_NOTICE);
}
else
{
    ini_set('display_errors', 0);
    ini_set('log_errors', 1);
}
to

Code: Select all

error_reporting(E_ALL);
Then try uploading an attachment again and let me know if you get any other error messages.

Posted: Thu Jul 15, 2010 8:03 am
by JonnyEQ
Klemen wrote:I definitely need more info about the error then. Try this:
- backup your hesk_settings.php file
- manually edit the hesk_settings.php file: open it in Notepad and change

Code: Select all

if ($hesk_settings['debug_mode'])
{
    error_reporting(E_ALL ^ E_NOTICE);
}
else
{
    ini_set('display_errors', 0);
    ini_set('log_errors', 1);
}
to

Code: Select all

error_reporting(E_ALL);
Then try uploading an attachment again and let me know if you get any other error messages.
Hi Klemen, I changed the code in the hesk_settings.php file and I still get the same message saying.

Error:

Cannot move file to the attachments folder, please check your server path settings

:(
Jonah

Posted: Thu Jul 15, 2010 4:03 pm
by Klemen
Ok, here's the last thing we can try:

open submit_ticket.php in Notepad and change

Code: Select all

hesk_error($hesklang['cannot_move_tmp']);
to

Code: Select all

die("DEBUG:<br><br>FILES:<br>".nl2br(print_r($_FILES,true))."<br><br>COPY TO: ".$hesk_settings['server_path'].'/attachments/'.$file_name."<br><br>IS WRITABLE: ".(is__writable($hesk_settings['server_path'].'/attachments/') ? 'YES' : 'NO'));
and also paste this inside the submit_ticket.php file just above the very last ?>

Code: Select all

function is__writable($path) {
    if ($path{strlen($path)-1}=='/') // recursively return a temporary file path
        return is__writable($path.uniqid(mt_rand()).'.tmp');
    else if (is_dir($path))
        return is__writable($path.'/'.uniqid(mt_rand()).'.tmp');
    // check tmp file for read/write capabilities
    $rm = file_exists($path);
    $f = @fopen($path, 'a');
    if ($f===false)
        return false;
    fclose($f);
    if (!$rm)
        unlink($path);
    return true;
}


Try to attach something as customer and let me know what it says.

Posted: Fri Jul 16, 2010 10:07 am
by JonnyEQ
Klemen wrote:Ok, here's the last thing we can try:

open submit_ticket.php in Notepad and change

Code: Select all

hesk_error($hesklang['cannot_move_tmp']);
.
Hi Klemen, I do not have this line in my file. Where it does say hesk_error, this is folloowed by an underscore and buffer. So it reads 'hesk_error_buffer'. Even when it says this. I cannot see anything which reads cannot_move.

:(

Posted: Fri Jul 16, 2010 2:29 pm
by Klemen
Oh, sorry, it's in the inc/attacmnets.inc.php file.

Posted: Mon Jul 19, 2010 8:58 am
by JonnyEQ
Klemen wrote:Oh, sorry, it's in the inc/attacmnets.inc.php file.
Do I place this code below in the attachments file as well?

Code: Select all

function is__writable($path) { 
    if ($path{strlen($path)-1}=='/') // recursively return a temporary file path 
        return is__writable($path.uniqid(mt_rand()).'.tmp'); 
    else if (is_dir($path)) 
        return is__writable($path.'/'.uniqid(mt_rand()).'.tmp'); 
    // check tmp file for read/write capabilities 
    $rm = file_exists($path); 
    $f = @fopen($path, 'a'); 
    if ($f===false) 
        return false; 
    fclose($f); 
    if (!$rm) 
        unlink($path); 
    return true; 
}

Posted: Mon Jul 19, 2010 9:04 am
by JonnyEQ
Klemen wrote:Oh, sorry, it's in the inc/attacmnets.inc.php file.
I entered it into the attachments file. I then tried to attach a file and got this.

DEBUG:

FILES:
Array
(
[attachment] => Array
(
[name] => Array
(
[1] => Crystal Reports Reporting Services Overview.doc
[2] =>
[3] =>
[4] =>
[5] =>
[6] =>
[7] =>
)

[type] => Array
(
[1] =>
[2] =>
[3] =>
[4] =>
[5] =>
[6] =>
[7] =>
)

[tmp_name] => Array
(
[1] =>
[2] =>
[3] =>
[4] =>
[5] =>
[6] =>
[7] =>
)

[error] => Array
(
[1] => 1
[2] => 4
[3] => 4
[4] => 4
[5] => 4
[6] => 4
[7] => 4
)

[size] => Array
(
[1] => 0
[2] => 0
[3] => 0
[4] => 0
[5] => 0
[6] => 0
[7] => 0
)

)

)


COPY TO: C:/wamp/www/Cashs_HELPDESK/attachments/A1ZP6AGBQJ_45e5a92131f6000dcb1cf50abc526ab5.doc

IS WRITABLE: YES

Hope this helps.

Cheers.

Posted: Mon Jul 19, 2010 12:56 pm
by Klemen
The file wasn't uploaded because the uploaded file size exceeds the upload_max_filesize directive in php.ini.
http://www.php.net/manual/en/features.f ... errors.php
(VALUE 1)

So the entire thing errors out before it can even be handled by Hesk.