Add some code and a form to your Home (index.php) page that allows the user to upload a small image file to a
directory called images under your class folder where the HTML form resides.
Limit the uploaded file to no more than 100,000 bytes.
Display the uploaded image in your Home (index.php) page.
Make the action page for your form, the same page that the form is in, meaning:
your Home (index.php) page. Put a PHP test/condition into the Home (index.php) page which displays the
form until it has been submitted, and displays the uploaded image after the form has
been submitted.
During the processing that occurs after the form has been submitted,
save the image file into your
images directory.
HINT: If you use the sample code from the section "Uploading a File"
in the e-handout, you will need to change the value that is assigned to the
variable $target_path to "images/" instead of "tmp/".
Also put into the PHP action page (which is the Home page), some code which makes an HTML
<img> tag which displays the uploaded image. In order to make things
simple, you do not need to include width
or height attributes in the <img> tag. But you
will need to put in an alt attribute and a title attribute so the page validates
in the W3C HTML Validator.
HINT: You can echo the <img> tag into the action page.
HINT: In this <img> tag that you are echoing into your action
page, you can probably use the variable $target_path to supply the
folder and filename for the src attribute.
Test your page on the PHP Web server by uploading your modified Home (index)
page to your class Web site, then clicking your student number on the
"Student Sites" page of this class site. Upload a small image file and make sure it displays in the
page.