Prev | Current Page 455 | Next

W. Jason Gilmore

"Beginning PHP and MySQL: From Novice to Professional"

Although FTP
historically has been the standard means for uploading files to a server, such file transfers
are becoming increasingly prevalent via a Web-based interface. In this chapter, you??™ll
learn all about PHP??™s file-upload handling capabilities, in particular, the following:
??? PHP??™s file-upload configuration directives
??? PHP??™s $_FILES superglobal array, used to handle file-upload data
??? PHP??™s built-in file-upload functions: is_uploaded_file() and
move_uploaded_file()
??? A review of possible error messages returned from an upload script
??? An overview of the HTTP_Upload PEAR package
As always, numerous real-world examples are offered throughout this chapter,
providing you with applicable insight into this topic.
Uploading Files via HTTP
The way files are uploaded via a Web browser was officially formalized in November
1995, when Ernesto Nebel and Larry Masinter of the Xerox Corporation proposed a
standardized methodology for doing so within RFC 1867, ???Form-Based File Upload
in HTML??? (http://www.ietf.org/rfc/rfc1867.txt). This memo, which formulated
the groundwork for making the additions necessary to HTML to allow for file uploads
388 CHAPTER 15 ?–  HANDL ING F ILE UPLOADS
(subsequently incorporated into HTML 3.0), also offered the specification for a new
Internet media type, multipart/form-data. This new media type was desired
because the standard type used to encode ???normal??? form values, application/
x-www-form-urlencoded, was considered too inefficient to handle large quantities of
binary data such as that which might be uploaded via such a form interface.


Pages:
443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467