0kb file uploads, blank documents.

uktran

Member
Using the file upload element on pretty much default settings, local storage, no ajax, I have an issue with blank uploads of microsoft office files, especially docx.

It's relatively rare, probably somewhere in the region of 0.5% of form submissions.

The file is uploaded, retains filename, and opens fine when downloaded, but is blank and has a filesize of 0kb. Reupload the same local file again, and it works fine, it seems random.

If this error rate is just par for the course, is it easy to subsequently validate for != 0kb somehow without manually opening each upload?

For example, a manually triggered list php plugin? Something that updates a field to 1 if > 0kb, or something like that?

Or is there a possibility something is wrong with the setup?
 
Last edited:
This isn't something I've ever experienced, or that anyone else has ever reported, so I suspect it's specific to your server, and sounds like some kind of OS / web server / PHP issue. All we do (as far as file handling itself) during an upload of local storage is call JFile::upload(), to move the file from the web server's temporary upload folder to the destination folder.

One possibility is that we do tell JFile::upload() whether to do a safety check (which is an option in our upload element settings), which will check for things like PHP code or other known attack vectors. But if it fails that check, the upload itself should fail and error out, although I haven't tested that recently, it's possible it might fail silently.

Have you check your log files to see if there are any clues? If anything goes wrong in JFile::upload() it should log a warning.

Another thing to check is that your server has enough free disk space. Unlikely in this day and age to run out of space, but it does sometimes happen, and might cause a file size of 0.

Another possibility is that if you are doing file checking (haven't specifically disabled that), you might run out of memory during the check operation if the file is very large, as J! has to load the entire file into memory to analyze it.

-- hugh
 
Back
Top