• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

PHP file upload question about /tmp

fs5

Lifer
A little php novice here, perhaps this is universal to the server.

I have a form to upload files, and php does a move_uploaded_file() after the form is being processed. However sometimes the file will not get copied over. I believe the temp file gets stored in to /tmp . Is it because the server is deleting this file too fast before php can copy the file over?

Is there a way set the "tmp" folder for these uploads else where? Or would I have to tell the service provider to do something about it?
 
I ran some tests.

I upload 2 500kb files via a fast connection (300kb/s) and it works fine, I upload 2 500kb files via a slow (20kb/s) connection and it doesn't work.. it never copies the files over. I'm assuming they are getting deleted from the tmp folder before I can copy them. all the php tutorials for uploading state that they get dumped into a temporary location. $_FILES['file1']['tmp_name'] is what it's stored as. I print out this and I get /tmp/CIWNciasjwEJKR.

what else can be going on?
 
Originally posted by: fs5
I ran some tests.

I upload 2 500kb files via a fast connection (300kb/s) and it works fine, I upload 2 500kb files via a slow (20kb/s) connection and it doesn't work.. it never copies the files over. I'm assuming they are getting deleted from the tmp folder before I can copy them. all the php tutorials for uploading state that they get dumped into a temporary location. $_FILES['file1']['tmp_name'] is what it's stored as. I print out this and I get /tmp/CIWNciasjwEJKR.

what else can be going on?

check the script timeout settings in phpinfo(). PHP may be terminating the script because its taking too long to upload (ie, the script is taking too long to execute). I think the default is 20 seconds.
 
Originally posted by: Zugzwang152
check the script timeout settings in phpinfo(). PHP may be terminating the script because its taking too long to upload (ie, the script is taking too long to execute). I think the default is 20 seconds.

Timeouts Connection: 300 - Keep-Alive: 5
default_socket_timeout 60 60

Had a little chat with DeviousTrap, service provider, and he confirms that Cpanel deletes files in the /tmp that aren't it's own with avengence 🙁
Looks like I'll have to use perl.
 
Originally posted by: fs5
Originally posted by: Zugzwang152
check the script timeout settings in phpinfo(). PHP may be terminating the script because its taking too long to upload (ie, the script is taking too long to execute). I think the default is 20 seconds.

Timeouts Connection: 300 - Keep-Alive: 5
default_socket_timeout 60 60

Had a little chat with DeviousTrap, service provider, and he confirms that Cpanel deletes files in the /tmp that aren't it's own with avengence 🙁
Looks like I'll have to use perl.

well, :thumbsup: for DeviousTrap getting back to you so quickly.
 
Back
Top