Php File Upload

2,244 views

Published on

Detail of PHP directives that affects file uploading.

Published in: Technology
  • Be the first to comment

Php File Upload

  1. 1. PHP File uploading post_max_size, upload_max_filesize & memory_limit
  2. 2. Write an HTML <ul><li>PHP Documentation </li><ul><li>http://www.php.net/manual/features.file-upload.php
  3. 3. enctype=”multipart/form-data” means “Content-type of HTTP Request is multipart/form-data” </li></ul></ul>
  4. 4. PHP Directives post_max_size upload_max_filesize upload_max_filesize PHP 5.2 File File header Part 1 Part 2 Part 3 decode decode HTTP Request HTTP Request Header Content-type: multipart/form-data HTTP Request Body Decoding needs tiny working buffer. The buffer is allocated within memory_limit .
  5. 5. PHP Directives <ul><li>At least, you must satisfy
  6. 6. memory_limit </li><ul><li>There are almost no relations with file uploading.
  7. 7. If you want to read whole uploaded files in PHP, you'll consume huge memory. But it is another thing from file uploading. </li></ul></ul>post_max_size > upload_max_filesize * (how many files) * 1.3 PHP 5.2
  8. 8. Appendix. Specifications <ul><li>XHTML </li><ul><li>http://www.w3.org/TR/xhtml1/
  9. 9. See HTML4 spec </li></ul><li>HTML 4 </li><ul><li>http://www.w3.org/TR/html4/
  10. 10. 17.13.4 Form content types
  11. 11. See RFC 2388 </li></ul><li>RFC 2388 </li><ul><li>http://www.ietf.org/rfc/rfc2388.txt </li></ul></ul>

×