Prev | Current Page 459 | Next

W. Jason Gilmore

"Beginning PHP and MySQL: From Novice to Professional"

As a rule of thumb,
this directive setting should be larger than upload_max_filesize, to account for any other
form fields that may be passed in addition to the uploaded file. Like memory_limit and
upload_max_filesize, M must follow the integer value.
The $_FILES Array
The $_FILES superglobal is special in that it is the only one of the predefined EGCPFS
(environment, get, cookie, put, files, server) superglobal arrays that is two-dimensional.
Its purpose is to store a variety of information pertinent to a file (or files) uploaded to
the server via a PHP script. In total, five items are available in this array, each of which
is introduced here:
?– Note Each of the items introduced in this section makes reference to userfile. This is simply a
placeholder for the name assigned to the file-upload form element. Therefore, this value will likely
change in accordance to your chosen name assignment.
CHAPTER 15 ?–  HANDL ING F ILE UPLOADS 391
??? $_FILES['userfile']['error']: This array value offers important information
pertinent to the outcome of the upload attempt. In total, five return values are
possible, one signifying a successful outcome, and four others denoting specific
errors that arise from the attempt. The name and meaning of each return value
is introduced in the later section ???Upload Error Messages.???
??? $_FILES['userfile']['name']: This variable specifies the original name of the
file, including the extension, as declared on the client machine.


Pages:
447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471