Download problem
Hello! I try to download a file from a CGI script. Here is the code: $self-header_props(-type='application/x-octet-stream', -attachment=$file); open(FILE, $file); binmode(FILE); $/ = undef; my($data) = FILE; close(FILE); binmode(STDOUT); print $data; I am using CGI::App, but the problem is not there. Anyway, the file is written directly in the browser, I don't get a Save to disk dialog. The arguments of the header_props() function are exactly the same as for the header() of CGI.pm. So how do I solve this problem? Do I miss something here? Thank you! -- Regards, Stelian I. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: File upload problem
On Jo, 2002-11-28 at 09:55, Stelian Iancu wrote: Hello! I have a simple form with a file upload field. Then, I want to save the uploaded file into a directory. So here it the code: #!/usr/bin/perl use strict; usw warnings; use CGI; my $q = new CGI; my $filename = $q-upload('fisier'); my $buffer; open (OUTFILE, /test/$filename); while (read($filename,$buffer,16384)) { print OUTFILE $buffer; } In the end, it will allow users to upload only .zip files and I tried with a sample zip file. The file is not copied correctly. Can you tell me where the problem is? Thanks! -- Regards, Stelian I. The problem was binmode. I put binmode($filename) and it worked. I also discovered the File::Copy module and it worked using that module too. So I guess I can use anyone of these approaches. Also, are there any other gotchas that I have to take care in this case? Thanks! -- Regards, Stelian I. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
File upload problem
Hello! I have a simple form with a file upload field. Then, I want to save the uploaded file into a directory. So here it the code: #!/usr/bin/perl use strict; usw warnings; use CGI; my $q = new CGI; my $filename = $q-upload('fisier'); my $buffer; open (OUTFILE, /test/$filename); while (read($filename,$buffer,16384)) { print OUTFILE $buffer; } In the end, it will allow users to upload only .zip files and I tried with a sample zip file. The file is not copied correctly. Can you tell me where the problem is? Thanks! -- Regards, Stelian I. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]