I know I asked a similar question a while back, but I'm compelled to try again.

I have an existing script, not using CGI to take in parameters handed to the
script.  I would now like to have this script upload a file to the server, but
not be forced to convert the entire file to using CGI.

This is the code I've used in the past:
-------------------------------------------------------------
        use CGI;
        #create new instantiation of a form query.
        my $query = new CGI;

        open (UPLOAD, ">$filepath") || &Error("Could not open file for writing:
$filepath");
        my $picture = $query->upload('photo');
        if ($picture) {
                while ($bytesread=read($picture,$buffer,1024)) {
                        print UPLOAD $buffer;
                }
        }else {
                &Error("Picture ($picture) is undefined.<br> File: 
$photoName<br>For some
reason I cannot read in this file.");
        }
        close (UPLOAD);
-------------------------------------------------------------

But as you can see, it's using CGI.
Any suggestions of how to upload an image similarly without having to rewrite
the rest of my code?

Thanks.
--Alex
 
_______________________________________________
Boston-pm mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/boston-pm

Reply via email to