Attachments

Helpdesk for my helpdesk software

Moderator: mkoch227

JonnyEQ
Posts: 14
Joined: Thu Feb 04, 2010 12:23 pm

Attachments

Post 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
Last edited by JonnyEQ on Mon Jul 12, 2010 8:58 am, edited 4 times in total.
Klemen
Site Admin
Posts: 10139
Joined: Fri Feb 11, 2005 4:04 pm

Post 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.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
JonnyEQ
Posts: 14
Joined: Thu Feb 04, 2010 12:23 pm

Post by JonnyEQ »

Sorry about lack of info. Hope this helps.
Klemen
Site Admin
Posts: 10139
Joined: Fri Feb 11, 2005 4:04 pm

Post 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:
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
JonnyEQ
Posts: 14
Joined: Thu Feb 04, 2010 12:23 pm

Post 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.
Klemen
Site Admin
Posts: 10139
Joined: Fri Feb 11, 2005 4:04 pm

Post 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
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
JonnyEQ
Posts: 14
Joined: Thu Feb 04, 2010 12:23 pm

Post 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
Klemen
Site Admin
Posts: 10139
Joined: Fri Feb 11, 2005 4:04 pm

Post 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.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
JonnyEQ
Posts: 14
Joined: Thu Feb 04, 2010 12:23 pm

Post 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
Klemen
Site Admin
Posts: 10139
Joined: Fri Feb 11, 2005 4:04 pm

Post 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.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
JonnyEQ
Posts: 14
Joined: Thu Feb 04, 2010 12:23 pm

Post 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.

:(
Klemen
Site Admin
Posts: 10139
Joined: Fri Feb 11, 2005 4:04 pm

Post by Klemen »

Oh, sorry, it's in the inc/attacmnets.inc.php file.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
JonnyEQ
Posts: 14
Joined: Thu Feb 04, 2010 12:23 pm

Post 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; 
}
JonnyEQ
Posts: 14
Joined: Thu Feb 04, 2010 12:23 pm

Post 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.
Klemen
Site Admin
Posts: 10139
Joined: Fri Feb 11, 2005 4:04 pm

Post 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.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Post Reply