Upload files

Syntax for upload files:
<input type="file" name="field_name">

This form is unlike other forms, because it has not a value attribute. This form is is gettable and not settable. That means the value only can be entered by the user.

In an upload form there must also be the enctype tag.
The enctype="multipart/form-data" telling the server that the form include a file being uploaded in addition to any data entered in the form.

When a file is selected, the full path will be visible in the upload field. After submitting the file will be send to the server where it can be processed.

The basic upload image form:

Notice the use of "cgi.script_name" that will submit the form to the same page.

<form action="<cfoutput>#cgi.script_name#</cfoutput>" method="post"
enctype="multipart/form-data">
  File:
  <input type="file" name="File_To_Upload" />
  <br />
  <input name="submit" type="submit" value="Upload File" />
</form>

The upload form:




The dialog box:



Advertisement

No User Comments.

No User Comments, be the first one to write your comments?

ApplayIT is owned by Scandic Systems LTD [UK] Company No. 5984000. All other trademarks and copyrights are the property of their respective holders.