Starting from WebRainbow v1.4, there are following 8 functions for file uploading.
The three of them are related to the settings for file uploading:
Calling these functions are optional, WebRainbow has the default value for
these settings.
The other five functions makes application easy to handle the uploaded files:
The application can use one or more of these functions to deal with uploaded files based on the
application's requirement.
Demo:
Here, the sample program demoFileUpload shows how to use these functions to
process the files uploaded from the HTML page.
- In the procedure Sub ProcessUpload(), the first called
WebRainbow function is SpecityContentType to
specify the application accepts the MIME type of "Multipart/Form-data" only. This is the only type
of HTML page used for file uploading.
- Next, the Sub ProcessUpload() uses
SetContentLength with the constant
clRetrieveAllData to let WebRainbow
process all the data passed in by the browser.
- Then the Sub ProcessUpload() calls
SetMaxUploadFiles to set maximun number of files to be processed to 12.
So after 12 files processed, all the other file(s), if there are any remaining files, is/are
discarded.
- And calls SetTempDirectory to specify the temporary directory which is
used for holding the file(s) during the process.
- The next several lines of code are going to get total number of processed upload files, retrieve the
name of each file and save them to the specified location with given name.
To make this sample program demoFileUpload more usefull, there are other
procedures for file listing and file downloading functionalities.
Note:
- The VB source code demoFileUpload.bas is for
Visual Basic 6 & 5 only, Visual Basic 4 32-bit version is not included.
To compile this sample, follow the steps listed bellow:
- Start Visual Basic
- Select Standard EXE as project type
- Select Sub Main as Startup Object
- Give demoFileUpload as project name
- Set reference to WRHttpB.tlb,
WRMimeB.tlb, and
WRnbwB.tlb
- Remove Form1, which is the default form for new VB project
- Add demoFileUpload.bas (source code for Visual Basic 5 & 6) into the
Project demoFileUpload. This file is normally in the folder
C:\Program Files\WebRainbow\demo\fileupload\
if you did not change the installation directory for WebRainbow.
- Compile it to demoFileUpload.exe.
To debug HttpPost:
To run this sample, click on the following link for instruction of
For the latest information on WebRainbow, please see:
For questions / comments please email to:
Copyright © 2000 - 2005 D.M.F. Systems, Corporation. All rights reserved.
Last modified on March 2, 2005