in reply to Spreadsheet::XLS chokes on CGI uploads
G'day tbodine88,
Welcome to the monastery.
From Spreadsheet::XLSX's source code on CPAN:
sub new { my ($class, $filename, $converter) = @_; my $self = {}; $self -> {zip} = Archive::Zip -> new (); if (ref $filename) { $self -> {zip} -> readFromFileHandle ($filename) == Archive::Z +ip::AZ_OK or die ("Cannot open data as Zip archive"); } else { $self -> {zip} -> read ($filename) == Archive::Zip::AZ_OK or d +ie ("Cannot open $filename as Zip archive"); }; ... }
Line 28 is the one with the "Cannot open data as Zip archive" message you're getting. When you "tried uploading and copying to a file", did you get the line 33 error message?
If this is working when you download via FTP, but not working when uploading via CGI, this suggests you may have a problem with your upload code (which you haven't shown).
Not having seen your CGI code, these are just suggestions which may prove fruitful. Take a look at CGI: PROCESSING A FILE UPLOAD FIELD. There's a lot of useful information there including example code. Also, look at CGI: Avoiding Denial of Service Attacks. See what it says about uploads here and look at the information about the $CGI::POST_MAX and $CGI::DISABLE_UPLOADS variables.
You may also want to consider using Spreadsheet::ParseXLSX instead of Spreadsheet::XLSX. The former is being actively maintained; the latter hasn't been touched in four years and has dozens of outstanding bugs.
-- Ken
|
|---|