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


In reply to Re: Spreadsheet::XLS chokes on CGI uploads by kcott
in thread Spreadsheet::XLS chokes on CGI uploads by tbodine88

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.