Skip Menu |

This queue is for tickets about the CGI-Simple CPAN distribution.

Report information
The Basics
Id: 5774
Status: rejected
Priority: 0/
Queue: CGI-Simple

People
Owner: Nobody in particular
Requestors: mk [...] interzone.gr
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.071
Fixed in: (no value)



Subject: upload_info not exported, uploads don't work
upload_info is not exported in CGI::Simple::Standard. That's an easy one. uploads not working though :( code sample : use CGI::Simple::Standard qw(param header upload upload_info cgi_error); $CGI::Simple::Standard::POST_MAX = 1024000; $CGI::Simple::Standard::DISABLE_UPLOADS = 0; $test='file_name'; $fh = upload($test); $save_path = '/tmp/'.param($test); open FH, ">$save_path" or die "Oops - !! $!\n"; binmode FH; my $buffer; while ( read( $fh, $buffer, 4096 ) ) { print FH $buffer; } close FH; that uploads an empty file. The demo interface mentioned in the documentation (with the second parameter to the upload() function) has the same results. Just changing the references to CGI::Simple back to CGI works as expected (i.e. file correctly uploaded) Full demo script available upon request.
[guest - Tue Mar 23 15:10:03 2004]: Show quoted text
> upload_info is not exported in CGI::Simple::Standard. > That's an easy one. > > uploads not working though :( > > code sample : > > use CGI::Simple::Standard qw(param header upload upload_info > cgi_error); > $CGI::Simple::Standard::POST_MAX = 1024000; > $CGI::Simple::Standard::DISABLE_UPLOADS = 0; > > $test='file_name'; > > $fh = upload($test); > $save_path = '/tmp/'.param($test); > open FH, ">$save_path" or die "Oops - !! $!\n"; > binmode FH; > my $buffer; > while ( read( $fh, $buffer, 4096 ) ) { > print FH $buffer; > } > close FH; > > that uploads an empty file. The demo interface mentioned in the > documentation (with the second parameter to the upload() function) has > the same results. > > Just changing the references to CGI::Simple back to CGI works as > expected (i.e. file correctly uploaded) > > Full demo script available upon request.
I think you are confusing a detail that is a difference between how CGI.pm and CGI::Simple handle file uploads. With CGI.pm, the argument to upload() is a file field name. With CGI::Simple, it's the actual name of the file passed through the file upload field. (I'm using CGI::Simple's file upload feature with a problem).
From: mk [...] interzone.gr
[MARKSTOS - Sat Apr 24 12:44:58 2004]: Show quoted text
> [guest - Tue Mar 23 15:10:03 2004]: >
> > upload_info is not exported in CGI::Simple::Standard. > > That's an easy one. > > > > uploads not working though :( > > > > code sample : > > > > use CGI::Simple::Standard qw(param header upload upload_info > > cgi_error); > > $CGI::Simple::Standard::POST_MAX = 1024000; > > $CGI::Simple::Standard::DISABLE_UPLOADS = 0; > > > > $test='file_name'; > > > > $fh = upload($test); > > $save_path = '/tmp/'.param($test); > > open FH, ">$save_path" or die "Oops - !! $!\n"; > > binmode FH; > > my $buffer; > > while ( read( $fh, $buffer, 4096 ) ) { > > print FH $buffer; > > } > > close FH; > > > > that uploads an empty file. The demo interface mentioned in the > > documentation (with the second parameter to the upload() function)
> has
> > the same results. > > > > Just changing the references to CGI::Simple back to CGI works as > > expected (i.e. file correctly uploaded) > > > > Full demo script available upon request.
> > > I think you are confusing a detail that is a difference between how > CGI.pm and CGI::Simple handle file uploads. With CGI.pm, the argument > to > upload() is a file field name. With CGI::Simple, it's the actual name > of > the file passed through the file upload field. > > (I'm using CGI::Simple's file upload feature with a problem).
Alhtough it's closed, I was re-writting some code and was hit by the same bug again. You may succesfully use CGI::Simple's file upload , but you cannot use CGI::Simple::Standard's file upload function. None of the recommended by the documentation options work. These do: a) Changing line 22 of Simple.pm from $DISABLE_UPLOADS = 1 to $DISABLE_UPLOADS = 0 allows uploads. b) using line : use CGI::Simple::Standard qw(param header Vars -upload upload); instead of use CGI::Simple::Standard qw(param header Vars upload); also works Please, test before answering again. Thanks