Thunderstone Software Document Search, Retrieval, and Management
Search:
Texis Tutorial
 

10.6 Multi-part File Uploads

In addition to the usual variables imported from POST and GET forms, Vortex also imports variables from a form-based multi-part file upload, if the user's browser supports them. This provides an easy way to upload binary files in a form. For example, we can upload a GIF with the following form:


  <FORM METHOD=post ACTION="$url/func.html"
       ENCTYPE="multipart/form-data">
    File to upload: <INPUT TYPE=file NAME=image ACCEPT="image/gif">
    <BR>Description: <INPUT TYPE=text NAME=desc>
    <INPUT TYPE=submit VALUE="Submit">
  </FORM>

This form would present the user with a file-select dialog box (for the $image variable) and a plain text box (for the $desc variable). On submission, the browser sends the file the user selected, and the Vortex variable $image would contain the contents of that file - a GIF image if the user selected one. Any other type variables on the form (eg. $desc ) are imported as usual.

To the user this form would look like this:

Netscape: Untitled

File Edit View Go Communicator
Location:
File to upload:
Description:

Variable info

The <varinfo> function has additional use for multi-part form variables. While the $image variable has the contents of the user's file, we can find out what that file name was with <varinfo filename image> . This is useful if we want to save the variable to a file on our server and keep the same file name.

Calling <varinfo contenttype image> will tell us the Content-Type of $image , for example whether it was truly a GIF or a JPG instead.
Back: Creating User Functions in C Next: Controlled Access Applications

 
Home   ::   Products   ::   Solutions   ::   How to Buy   ::   Support   ::   Contact Us   ::   News   ::   About
Copyright © 2013 Thunderstone Software LLC. All rights reserved.