Why might a file only be partially uploaded?

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

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.


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


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.