VB5/CGI/uploading binary files
Posted on 1997-10-24
I want to use an HTML form to have a user of the form be able to upload a binary file and then send it to a CGI script. The CGI script will save this file in the cgibin directory(so if this is a .exe file, the script will save it to the disk as something.exe. If it is a .gif file, it will save it to the disk as something.gif, etc.). I am using the cgi32.bas module.
The problem that I am having is that I'm not sure how to put the file data in to a file after it is submitted. "cgi32.bas" has the "getsmallfield" function to get fields submitted through a form, but as the name says it, it only "gets" small amounts of data. Also, it returns data as string elements and not as binary (I'm not sure if this makes a difference).
The HTML code that I'm planning to use is at the bottom. Basically, it allows the user of the form to browse his hard drive and to select a file he wants to submit.
<FORM action="processfile.exe" enctype="multipart/form-data" method="Post">
Location: <INPUT name="fileupload" type="file" size=30>
<INPUT type="submit" value="Send">