Please help me upload a binary file through a CGI script.

Mark Steele msteele at
Wed Nov 27 18:18:21 CST 2002

Thanks Chris,

I tried it but still get weird error, maybe it's Apache?
Text files are fine, but when I select an Excel file I get:

[Wed Nov 27 16:16:08 2002] [error] [client] Premature end of
script headers: /opt/apache2/lib/cgi-bin/upload-pm.cgi

I'm running out of time, I gotta go and start preparing for the feast

Thanks for your help, the code looks 100% better and I'm sure it 99% there,
I'll take it home and work on it over the long weekend...


> -----Original Message-----
> From: Chris Radcliff [mailto:chris_radcliff at]
> Sent: Wednesday, November 27, 2002 3:34 PM
> To: Mark Steele
> Cc: 'san-diego-pm-list at'
> Subject: Re: Please help me upload a binary file through a CGI script.
> Hi Mark,
> I've made a few changes to your code and added a lot of 
> comments about 
> what is actually going on. It looks like your use of warnings 
> (that -w) 
> caused the script to emit a warning before the first header, 
> which gave 
> Apache fits.
> I added lexical scoping ('my') to all your variables and gave them 
> default values (the || '') to avoid other warnings.
> The comments should explain it all, but let me know if you have any 
> questions.
> Cheers,
> ~chris
> On Wednesday, November 27, 2002, at 02:38  PM, Mark Steele wrote:
> > hey all Mongers,
> >
> > I'm trying to write a Perl CGI script that will upload an Excel file
> > using Apache on a HP-UX system.
> >
> > I've been using some of the code from the perldoc part of and
> > some code from the O'Reilly book "CGI Programming", I'm lost...
> >
> > All I want is a CGI script which will be called from a web page link
> > that will upload Excel files (or binary file in general), text files
> > would be nice too, but at a minimum just binary files.

The posting address is: san-diego-pm-list at

List requests should be sent to: majordomo at

If you ever want to remove yourself from this mailing list,
you can send mail to <majordomo at> with the following
command in the body of your email message:

    unsubscribe san-diego-pm-list

If you ever need to get in contact with the owner of the list,
(if you have trouble unsubscribing, or have questions about the
list itself) send email to <owner-san-diego-pm-list at> .
This is the general rule for most mailing lists when you need
to contact a human.

More information about the San-Diego-pm mailing list