handling file upload html

8
HANDLING FILE UPLOAD PROF. DAVID ROSSITER 1/8

Upload: nayana-ha

Post on 11-Jul-2016

238 views

Category:

Documents


0 download

DESCRIPTION

classes about handling file upload in HTML

TRANSCRIPT

Page 1: Handling File Upload HTML

HANDLING FILE UPLOADPROF. DAVID ROSSITER

1/8

Page 2: Handling File Upload HTML

AFTER THIS PRESENTATIONYou'll be able to handle file upload in a form

2/8

Page 3: Handling File Upload HTML

ELEMENTS & ATTRIBUTES WE WILL LOOK AT<input type="file">

3/8

Page 4: Handling File Upload HTML

UPLOADING FILESTwo parts: the browser and the server

The server part is discussed later

4/8

Page 5: Handling File Upload HTML

UPLOADING FILES - FORM STRUCTURE<form action="destination" method="post" enctype="multipart/form­data">

. . . other form input elements go here, if any . . .    <input type="file" name="fileToUpload">

    <input type="submit">

</form>

5/8

Page 6: Handling File Upload HTML

FILE UPLOAD EXAMPLE<form method="post" enctype="multipart/form­data"   action="http://ihome.ust.hk/~rossiter/cgi­bin/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

Page 7: Handling File Upload HTML

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

Page 8: Handling File Upload HTML

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