Re: I have problems with download scripts, it's trying to print instead of saving the file




"Gunnar Hjalmarsson" <noreply@xxxxxxxxx> wrote in message
news:3q3rvhFcu4s0U1@xxxxxxxxxxxxxxxxx
>E Arredondo wrote:
>>
>> use CGI;
>>
>> $upload_dir = "/upload";
>> $query = new CGI;
>> $filename = $query->param("photo");
>> $claim = $query->param("claim");
>> $filename =~ s/.*[\/\\](.*)/$1/;
>> $upload_filehandle = $query->upload("photo");
>> open UPLOADFILE, ">$upload_dir/$filename";
>> binmode UPLOADFILE;
>> while ( <$upload_filehandle> )
>> {
>> print UPLOADFILE;
>> }
>> close UPLOADFILE;
>> print $query->header ( );
>
> You may want to use the CPAN module CGI::UploadEasy. The above part of
> your script can be replaced with:
>
> use CGI::UploadEasy;
> my $ue = CGI::UploadEasy->new(-uploaddir => "/upload");
> my $cgi = $ue->cgiobject;
> my $claim = $cgi->param('claim');
> print $cgi->header;
>
> Now, as others have said, I doubt that you have a directory "/upload"
> under the server root. Maybe you mean "$ENV{DOCUMENT_ROOT}/upload".
> CGI::UploadEasy includes the necessary checks to find out.
>
>

Thanks for your help, Indeed there was no /upload, I though wrong. Do you
know if the CPAN CGI:UploadEasy will let me download whole folders ? Or Is
there a way to do a whole folder download ?

Thanks


.