Hai friends I am creating a file upload process, In that process I want to validate whether uploaded file contents are empty or not...
i want to validate txt, doc, pdf, xls , ppt, docx, msg these extension files.
when a .doc file is created then it has the file size has 10.5 KB, but it doesn't has the contents. I have to validate this, that uploaded file has content ??

thanks in advance....

7 Years
Discussion Span
Last Post by tawes01

You can't access the file selected from javascript alone. Also, you can't upload a file with AJAX. You can, however, submit your form to an iframe. Than, you can check the file's contents with PHP and echo back the results (and a javascript that calls the iframe parent). Also look at http://www.google.com/search?q=ajax%20iframe%20upload.

Edited by twiss: n/a


jquery: (not tested but should work)

if ($(".content").load('page.html')){
//code for file existing

I based this on the fact that the file wont return as true if its not there, but the problem is if the file thats its trying to get returns false it might not work=[

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.