Handling File Upload HTML
description
Transcript of Handling File Upload HTML
HANDLING FILE UPLOADPROF. DAVID ROSSITER
1/8
AFTER THIS PRESENTATIONYou'll be able to handle file upload in a form
2/8
ELEMENTS & ATTRIBUTES WE WILL LOOK AT<input type="file">
3/8
UPLOADING FILESTwo parts: the browser and the server
The server part is discussed later
4/8
UPLOADING FILES - FORM STRUCTURE<form action="destination" method="post" enctype="multipart/formdata">
. . . other form input elements go here, if any . . . <input type="file" name="fileToUpload">
<input type="submit">
</form>
5/8
FILE UPLOAD EXAMPLE<form method="post" enctype="multipart/formdata" action="http://ihome.ust.hk/~rossiter/cgibin/show_everything.php">
<p>Select the file you want to upload</p> <input type="file" name="fileToUpload">
<p>Press this button to send it</p> <input type="submit" value="Upload the file">
</form>
Select to open the HTML filehere
6/8
Select the file you want to upload
No file chosenChoose File
Press this button to send it
Upload the file
Select to open the HTML filehere
7/8
THE SERVER PROGRAMThe file is given to the required server program
The server program may do several things
It may move the file into another directory
It may save the file in a database
8/8