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.



PHP General Mailing List (
To unsubscribe, visit:

Reply via email to