This describes some advanced information on designing forms to take advantage of the "file upload" feature of Netscape. This assumes you are a proficient CGI SCRIPT programmer and are familiar with advanced Perl programming. If you have difficulty reading this material, then you probably need to seek help from a more knowledgeable programmer. For your form use ENCTYPE="multipart/form-data", example:
The input fields for file(s) to upload, my example shows 2 files: For the cgi script (myscript.pl), use CGI module: #!/usr/bin/perl use MIME::Base64; use CGI::Request; $req = new CGI::Request; $req->import_names('FORM'); now your form variables are put into $FORM::name The CGI module receives the upload and caches them into a temp file (owned by you in fact, NOT by the webserver process uid!). This filehandle is returned in the name of the field. Here is a code snippet example to pick up file1 and file2 and drop them into a local file. We are going to assume that file1 is textual and file2 is binary, the code to read the files differ somewhat. The binary read() will also work for text files too. if ($FORM::file1) { # user has uploaded file1 # this code assumes the file is text so we can do a to read it # binary files may require different treatment open(LOCALFILE, "> received_file1.txt"); while(<$FORM::file1>) { # read and write line-by-line print LOCALFILE $_; } close(LOCALFILE); } if ($FORM::file2) { # user has uploaded file2 open(LOCALFILE, "> received_file2"); while(read($FORM::file2, $buffer, 1024)) { print LOCALFILE $buffer; } close(LOCALFILE); } You dont have to worry about deleting the temp files, the system automatically deletes them once your script ends. David Lai BigBiz Internet Services http://www.bigbiz.com