Why might a file only be partially uploaded?
I am improving error-handling in my PHP file upload script and am trying to figure out how to handle UPLOAD_ERR_PARTIAL properly.
Should I prompt the user to try uploading the file again, or should I inform them that there is a more severe problem which is preventing them from uploading a possibly legitimate file?
Why might a file only be partially
uploaded?
This is usually caused by the user canceling the upload.
Should I prompt the user to try
uploading the file again, or should I
inform them that there is a more
severe problem which is preventing
them from uploading a possibly
legitimate file?
You should prompt them to try again and if problems continue to contact the site owners, including as much detail as possible.
UPLOAD_ERR_PARTIAL is given when the mime boundary is not found after the file data. A possible cause for this is that the upload was cancelled by the user (pressed ESC, etc).
I think it's enough to inform the user that the file is only partially uploaded and a retry will fix the problem.
This is an old post, but I had a random problem of UPLOAD_ERR_PARTIAL, and post my solution.
The problem is that after 2/3 upload I obtained an error of UPLOAD_ERR_PARTIAL, without any interruption by the client.
My problem was related to the Keep-Alive server.
I solved it by inserting at the end of the PHP script for uploading
header ("Connection: close");
that forces the closure of the connection. This has solved my problem.
I hope someone can help.
Thank to this LINK
Well, the file upload could be interrupted by:
Out of space in destination
Connection interruption
Damage file
Wrong name
Wrong extension
etc...
The best you can do is to verify and protect the upload process with does verifications before actually send the file to the server...
The first time I've made a file upload script, I used 1 line of code, now, the same script seems like a web page ;)
EDITED (example for controlling extension and file size):
if ((
($file_up["type"] == "image/gif") ||
($file_up["type"] == "image/jpeg") ||
($file_up["type"] == "image/jpg") ||
($file_up["type"] == "image/pjpeg") ||
($file_up["type"] == "image/bmp") ||
($file_up["type"] == "image/tiff") ||
($file_up["type"] == "image/png")) &&
($file_up["size"] < 1050000))
{
code if all ok...
}
This may help some people, but I had the same problem.
My solution was to uninstall libapache2-mod-php5filter and replace it with the classical libapache2-mod-php5
I have a same problem and was related with package libapache2-mod-php5filter , I remove the p and problem end.
I hope someone can help.