If you??™re interested in just retrieving the value of a single property, pass
a key to the getProp() call. For example, suppose you want to know the size (in bytes)
of the file:
echo $files->getProp('size');
This produces the following output:
22616
Uploading Multiple Files
One of the beautiful aspects of HTTP_Upload is its ability to manage multiple file
uploads. To handle a form consisting of multiple files, all you have to do is invoke a
new instance of the class and call getFiles() for each upload control. Suppose the
aforementioned professor has gone totally mad and now demands five homework
assignments daily from his students. The form might look like this:
CHAPTER 15 ?– HANDL ING F ILE UPLOADS 399
Handling this with HTTP_Upload is trivial:
$homework = new HTTP_Upload();
$hw1 = $homework->getFiles('homework1');
$hw2 = $homework->getFiles('homework2');
$hw3 = $homework->getFiles('homework3');
$hw4 = $homework->getFiles('homework4');
$hw5 = $homework->getFiles('homework5');
At this point, simply use methods such as isValid() and moveTo() to do what you will
with the files.
Pages:
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480