in reply to File source from memory

You need to check CGI a bit more carefully in the section entitled "CREATING A FILE UPLOAD FIELD". You don't open the $uploadfile. You can read from it directly as if it were a filehandle. This is, IMO, kinda silly. So, instead, you can get the filehandle directly using my $fh = CGI::upload('upload');. If you don't want to save it at all, check out CGI::upload_hook (which is not exported by default).

Replies are listed 'Best First'.
Re^2: File source from memory
by Anonymous Monk on Feb 18, 2005 at 18:37 UTC
    Thanks for your help. After reading what you wrote and what was on CGI again, it's still not running smoothly.
    my $fh = CGI::upload('upload'); print $fh;
    Still returns the C:\\path\name. (as I expected).
    while (<$fh>) { print; }
    Print out the file (from the docs) prints out just fine but it's not saving it.

    So I went back and tried to read in <$fh> and it says it cant be found.

    my $fh = CGI::upload('upload'); open(FILE, "$fh") or die "error: $!"; my $source = <FILE>; close (FILE);
    I can get it to print to the screen but it's saving either just the file name OR nothing at all and errors out.