Hi, I'm having trouble getting file uploads to work. Part of the problem is I don't understand where CGI fits in. The documentation is saying the uploads are done with CGI, but I've looked at the CGI file upload documentation but to me it looks like the actual upload bit doesn't require CGI. Same goes for the file upload sample. CGI seems to be used to create the upload form but after that the upload is just using perl's builtin 'read' function.
Or have I got the wrong end of the stick? Anyway, what I've got is an ASP page that has a regular form that posts the upload form data to another page (the upload field is called 'uploadedfile'). The 2nd page accepts the upload form data correctly but when 'read' is called I get nothing in my scalar (though the 'read' loop correctly loops until the file has been read). My code is as follows... ---- my $length = $Request->{TotalBytes}; print "TotalBytes = " . $length . "<br>"; my $fileup = $Request->{FileUpload}{uploadedfile}; my $filehandle = $fileup->{FileHandle}; my $PostedData = "FFF"; print "PostedData = " . $PostedData . "<br>"; print "Length = " . length($PostedData) . "<br>"; while (read($filehandle, $PostedData, 1024)) { print "a"; # data from the uploaded file read into $PostedData } my $ContentType = $fileup->{ContentType}; print "ContentType = " . $ContentType . "<br>"; print "PostedData = " . $PostedData . "<br>"; print "Length = " . length($PostedData) . "<br>"; ---- What I get as a result is something like this... TotalBytes = 46840 PostedData = FFF Length = 3 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ContentType = application/pdf PostedData = Length = 0 The FFF and the a's are just so I can test that PostedData is being changed and that the read is looping correctly and reading the right ammount of data. The incoming file data is the right size and the file is correctly being determined as a PDF. Yet PostedData ends up empty. ?? Or am I missing something else and the scalar is being filled but you just can't display the contents with a print (though PDF's are mostly printable)? I'm not too hot on Perl so scalars confuse me a little. Ultimately the PostedData goes via SWIG into a C++ app, but that's another matter, I just need it to get filled first. P.S. I don't called 'use CGI;' or anything, though I have tried without success. Tim. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]