Forum Moderators: coopster

Message Too Old, No Replies

Problem with partial form upload

         

optik

11:11 am on Dec 18, 2009 (gmt 0)

10+ Year Member



I have a form that sometimes doesn't send all the information, it doesn't happen very often and it always happens at the same point of the form. The php script that processes the form continues to work throughout, it is like the script never receives data after a certain point in the form (sent using POST).

The form is sending multiple files so can take a long time to send but it can send lots of files ok.

I don't understand what could be making it not work on certain occasions.

eelixduppy

4:32 pm on Dec 18, 2009 (gmt 0)



Sending multiple files is an issue that can lead to some unexpected results on occasion. There are many php.ini configuration directives that play a role here. There are also server-timeout considerations outside of PHP. Then of course, the clients connection also plays a role, assuming there is no interference with their connection in any way during the upload.

Take a look at the handling file uploads [php.net] section of the PHP documentation, and look at the directives associated with file uploads and make sure yours are set to a reasonable value. Also, with each unsuccessful file upload I like to log to the error log (error_log) the value of the error associated with that file upload. It will help you determine where things are going wrong in the long-run.

So see if you can't pin-point the problem first by looking towards your own server configuration, and then if the problem still happens occasionally it might even be you (the client) and your connection to your server. If you can separate the task of uploading files somehow, though, perhaps uploading them one at a time or by using another technology such as a Java Applet, then you will probably have more success with something like this.

rocknbil

8:43 pm on Dec 18, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



so can take a long time to send

Immediately after you get one of these, did you check your error logs? You may see "memory limit exhausted" or it's exceeding the upload size. Alternatively the browser could just be timing out.

Experiences with managing large file uploads [webmasterworld.com]

Another way around this is to use fork() in an exec command or pcntl_fork() if the extensions are installed. This may still break; if you're encountering a memory or upload limit error the child process could die.

optik

5:14 pm on Dec 20, 2009 (gmt 0)

10+ Year Member



thanks for the help, I think (fingers crossed) that I've fixed it I was sending the form in the background using an iframe and forwarding the page once my file progress bar was complete instead of checking if the form had also been sent.