Bill thanks for the help. Unfortunately, after adding Binmode to my code (I
think I did it right), I still can't get it to work. Does anyone have any
other ideas?
The current state of my script is located here:
http://www.inconnect.com/~jhess/cgi-bin/scriptupload.cgi
My somewhat convoluted code to upload .ZIP files is located here:
http://www.inconnect.com/~jhess/cgi-bin/scriptupload.txt
Could someone please give my script a shot, take a look at my code and tell
me what I'm doing wrong? I've tried everything I know (as much as I can for
a Perl newbie).
Thanks for your help!
- - - - - - - - - -
Jared Hess ([EMAIL PROTECTED])
Technical Writer / Webmaster
Wilcox Associates, Inc. (www.wilcoxassoc.com)
-----Original Message-----
From: $Bill Luebkert <[EMAIL PROTECTED]>
To: Jared Hess <[EMAIL PROTECTED]>
Cc: [EMAIL PROTECTED]
<[EMAIL PROTECTED]>
Date: Tuesday, March 06, 2001 4:38 PM
Subject: Re: zero filesize when uploading
>> Jared Hess wrote:
>>
>> I have nearly completed my first 'real' CGI script (yes I'm a Perl newbi)
which uploads a .zip file to a remote directory from a web form created by
my CGI script.
>>
>> I'm running across a problem with capitalized letters turning up in
submitted script filenames or pathways. Consequently, selecting a file via
my form's Browse button doesn't work because the pathway the button returns
always has a capital letter in it. Something like this:
"E:\temp\testfile.ZIP". If I press submit it actually does upload the file,
but for some reason those files always have a file size of 0, which I then
delete...
>>
>> Things I've tried:
>> * If I make all uppercase letters lowercase by manually changing them to
their lowercase equivalent in the upload field, it work's perfectly, and the
file has the correct file size.
>> * Using the lc() function to make the submitted filename and pathway
string lowercase does make them lowercase but I still get files of zero
size.
>> * I tried changing where the temp file is stored by using adding this
line:
>> $TempFile::TMPDIRECTORY='/WWW_ROOT';
>> That doesn't fix anything.
>> * I've tried using this line:
>> $tmpfile = tmpFileName($query->param('$fullfile'));
>> to find out where the temporary file is getting stored but that doesn't
work either. When it dies, my $tmpfile string doesn't print any info.
>> * I've looked at numerous message boards but to no avail...
>>
>> Has anyone encountered this problem before? Is there something wrong with
my script?
>>
>> I'm using:
>> * Windows NT 4.0 with SP6
>> * Perl (ActiveState for Win32)
>> * ISP's Server? (I dunno; I'm new at all this-- Perl Diver CGI shows that
my server software is Zeus/3.3 whatever that is)
>>
>> ## snip of my script ##
>> sub save_file {
>> $description = param('description');
>> $instructions = param('instructions');
>> $name = param('name');
>> $email = param('email');
>> $file = param('filename');
>> $file=lc($file);
>> $fullfile = $file;
>> $file=~s/^.*(\\|\/)//; # STRIP PATHWAY OFF!
>> ########################################
>> ## BEGIN UPLOAD AND RUN SOME TESTS
>> ########################################
>> ##
>> fileext_test(); ###### TESTS FOR CORRECT EXTENTION
>> filename_test(); ##### TESTS FOR DUPLICATE NAME ON SERVER
>>
>> open (SAVEFILE, ">$savedir$file") || dienice("Can't open filehandle:
$!\n");
>> while (read($fullfile, $buffer, 1024)) {
>> print SAVEFILE $buffer;
>> }
>> $tmpfile = tmpFileName($query->param('$fullfile')); ### THIS
TESTS THE LOCATION OF THE THE TEMP FILE CREATED DURING THE UPLOAD.
>> close(SAVEFILE) || dienice ("Can't close filehandle: $!\n");
>>
>> filesize_test(); ###### TESTS FOR VALID FILESIZE
>> nodata(); ##### TESTS FILE FOR DATA
>> ########################################
>> ########## END UPLOAD AND TESTS ########
>> ########################################
>> ## end snip ##
>
>If you're uploading binary data, you'll need to binmode input and output fi
les.
>
>--
> ,-/- __ _ _ $Bill Luebkert ICQ=14439852
> (_/ / ) // // DBE Collectibles http://www.todbe.com/
> / ) /--< o // // Mailto:[EMAIL PROTECTED] http://dbecoll.webjump.com/
>-/-' /___/_<_</_</_ http://www.freeyellow.com/members/dbecoll/
>_______________________________________________
>Perl-Win32-Web mailing list
>[EMAIL PROTECTED]
>http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web
_______________________________________________
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web