11.07.2015 Views

PHP MySQL - Stilson.net

PHP MySQL - Stilson.net

PHP MySQL - Stilson.net

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

www.it-ebooks.infoCHAPTER 15 • HANDLING FILE UPLOADSA Simple ExampleListing 15-1 (uploadmanager.php) implements the class notes example referred to throughout thischapter. To formalize the scenario, suppose that a professor invites students to post class notes to hisweb site, the idea being that everyone might have something to gain from such a collaborative effort. Ofcourse, credit should no<strong>net</strong>heless be given where credit is due, so each file upload should be renamed tothe last name of the student. In addition, only PDF files are accepted.Listing 15-1. A Simple File-Upload ExampleEmail:Class notes:}■ Caution Remember that files are both uploaded and moved under the guise of the web server daemon owner.Failing to assign adequate permissions to both the temporary upload directory and the final directory destinationfor this user will result in failure to properly execute the file-upload procedure.Although it’s quite easy to manually create your own file-upload mechanism, the HTTP_Upload PEARpackage truly renders the task a trivial affair.325

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!