faqts : Computers : Programming : Languages : JavaScript : Forms : File Upload

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

33 of 43 people (77%) answered Yes
Recently 8 of 10 people (80%) answered Yes

Entry

How can I let the user select a file and copy it or attache to a database?

Aug 26th, 2000 08:23
Martin Honnen, alena tutor,


Client side JavaScript is not used to select a file and not able to 
attach files to a database. What you usually do is using a file upload 
element
  <INPUT TYPE="file" NAME="fileName">
in a suitable FORM
  <FORM NAME="formName"
        ACTION="fileUploadHandler"
        METHOD="post"
        ENCTYPE="multipart/form-data"
   >
which then gives the user the possibility to select a file and upload 
it to the web server. On the webserver you file upload handler (a perl 
script or server side JavaScript or servlet) takes care of receiving 
the submitted file and storing it in a database (if you want to do so 
usually files are kept in the file system and only the path is stored 
in the db).