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).