Re: Trapping for PDF Type and file size in a UPLOAD form...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



At 9:50 AM -0700 7/29/10, Don Wieland wrote:
I am trying to create an UPLOAD form and need to figure a way to only allow PDF files to be selected.

The short answer is you can't -- not from php. You can create a standard form and upload it from there, but you don't have control over file type.

So you can't stop people from uploading anything to your site via the form, but you can look at the document once it's there and inspect it. Using a HEX Editor, I see that most pdf file have the first four bytes as "%PDF" so you might check that before moving the file to somewhere important. But that doesn't stop spoofing.

Other than that, I can't see any way to do it.

Cheers,

tedd
--
-------
http://sperling.com  http://ancientstones.com  http://earthstones.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux