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

Maybe you can use AJAX (with php)

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.

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=[

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.