Receiving Files from UsersMost popular browsers allow the developer to specify a form that lets users choose a file to upload to the server. To create a form to upload files, add an extra ENCTYPE attribute to the FORM element. Then use an INPUT field with the TYPE attribute set to FILE and the NAME attribute set to the name of the field. The FORM element will look like this:
<FORM ACTION="/cgi-shl/foxweb.exe/show_cgi" ENCTYPE="multipart/form-data" METHOD=POST>|
Your name: <INPUT TYPE="text" NAME=submitter>
File to send: <INPUT TYPE="file" NAME="UpFile">
<INPUT TYPE="submit" VALUE="Send File">
Uploaded file data is saved in the CgiFields array along with the other form fields. The file name is saved in the third column and the content type in the fourth. Data can be read directly from the CgiFields array or by using the FormField() function. The file data can be written to disk using the WriteFile() function.
FileName = "c:\temp\"+FormField("UpFile", , 2)|
Success = WriteFile(FileName, FormField("UpFile"))