Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the CGI CPAN distribution.

Report information
The Basics
Id: 32135
Status: resolved
Priority: 0/
Queue: CGI

People
Owner: MARKSTOS [...] cpan.org
Requestors: atodd [...] intergage.co.uk
thomas.weber [...] vr-web.de
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: upload files
Date: Mon, 7 Jan 2008 15:55:32 +0100
To: bug-CGI.pm [...] rt.cpan.org
From: Thomas Weber <thomas.weber [...] vr-web.de>
Hello, I`m using ActivePerl5.8.7.813 with CGI.pm Version 3.10 and I upload correctly any files, but than recently I updated to ActivePerl5.8.8.822 with CGi.pm Version 3.29 then the upload of any files doesn't work correctly, the uploaded files are 0 Bytes size. The Problem is appear when I call a Subroutine, and in the Subroutine I call "my $cgi = new CGI;" again. Can you help me for my problem? Sorry for my poor English! -- Mit freundlichen GrĂ¼ssen Thomas Weber mailto:thomas.weber@vr-web.de
Subject: Upload trouble
Date: Fri, 7 Mar 2008 11:32:18 +0000
To: <bug-CGI.pm [...] rt.cpan.org>
From: Andrew Todd <atodd [...] intergage.co.uk>
Perl Version:        5.10.0 built for MSWin32-x86-multi-thread
O/S:                    Windows XP ver 5.1.2600 (Service Pack 2)

Hi,
 
Had some problems with uploading files with CGI.pm ver 3.29. Using following code:
 
 
my $sUploadFile = $rCGI->param("uploadfile");
 
open(LOCAL, ">$sUploadsPath/$sFile") || return undef;
 
while(<$sFile>) { print LOCAL $_; }
 
close LOCAL;
 
 
$sFile as scalar only contains the filename (no path!) and doesn't seem to work as a filehandle at all.
 
Reverting back to CGI.pm ver 3.20 seems to solve the problem.
 
Over to to you chaps!

----------------------------------------------------------
Andrew Todd
Technical Developer

INTERGAGE
High-performance, updateable Web sites

Switchboard +44 (0)845 456 1022
Fax +44 (0)845 456 7024
==
www.intergage.co.uk
atodd@intergage.co.uk

Are you getting the most from your Web Marketing? If you would like to find out more about Search Engine Optimisation, Pay-per-Click advertising or Web Marketing in general, please do not hesitate to call us today on 0845 456 1022. We will be delighted to recommend the best solution for your on-line marketing needs.

Intergage Limited is a limited company registered in England and Wales, registered number: 3989761.
Registered office: Unit 8 Holes Bay Park, Sterte Avenue West, Poole, Dorset, BH15 2AA.
On Mon Jan 07 09:55:56 2008, thomas.weber@vr-web.de wrote: Show quoted text
> Hello, > > I`m using ActivePerl5.8.7.813 with CGI.pm Version 3.10 and I > upload correctly any files, but than recently I updated to > ActivePerl5.8.8.822 with CGi.pm Version 3.29 then the upload of > any files doesn't work correctly, the uploaded files are 0 Bytes size. > > The Problem is appear when I call a Subroutine, and in the Subroutine I > call "my $cgi = new CGI;" again. > > Can you help me for my problem?
CGI.pm 3.29 contained these changes: Version 3.29 1. The position of file handles is now reset to zero when CGI->new is called. (Mark Stosberg) 2. uploadInfo() now works across multiple object instances. Also, the first tests for uploadInfo() were added as part of the fix. (CPAN bug 11895, with contributions from drfrench and Mark Stosberg). #### They sound like they should *fix* a case like your rather than cause a bug. Are you still experiencing something that seems like a bug in CGI.pm? Mark
On Fri Mar 07 06:33:52 2008, atodd@intergage.co.uk wrote: Show quoted text
> Perl Version: 5.10.0 built for MSWin32-x86-multi-threadO/S: Windows XP > ver > 5.1.2600 (Service Pack 2) > Hi, Had some problems with uploading files with CGI.pm ver 3.29. Using > following code: my $sUploadFile = $rCGI->param("uploadfile"); > open(LOCAL, > ">$sUploadsPath/$sFile") || return undef; > > while(<$sFile>) { print LOCAL $_; } > > close LOCAL; $sFile as scalar only contains the filename (no path!) > and doesn't > seem to work as a filehandle at all. Reverting back to CGI.pm ver 3.20 > seems to > solve the problem. Over to to you chaps!
Thanks for the report, Andrew. Is Uploading with CGI.pm still a problem for you? The snippet you provided is not enough to reproduce the problem... It doesn't show where "$sFile" comes from. To proceed with a related change, we need a test which produces the issue. Maybe HTTP::Request::AsCGI would be useful in mocking up a file upload. Mark
From: susan_cassidy [...] yahoo.com
I am seeing the same kinds of problems as reported above when moving from a system with 3.15 to 3.29. I then tried 3.43, and am still having the same issues with one large program. I put some debug 'print STDERR' statements into CGI.pm, and saw that the problem program seemed to have issues when CGI.pm was at the end of 'sub upload'. When I dumped @param, the parameter I was interested in was 2nd, not 1st, and was being called in a scalar context, so the fh returned was not correct. When I started calling 'upload' in a list context, and looping through all filehandles, I got my data. I also noticed that when it failed, the filename was the long windows- style version, with escaped backslashes, but when it worked in a small program, the filename was just the last part of the name, after any slashes. I am trying to get a small test case program to work, but it only seems to fail in the large program. Only one call to 'new CGI', though, and I can find no error in any of the calls relevant to the file upload. I'm hoping this information will mean something to someone out there, and a fix can be found.
Subject: Re: [rt.cpan.org #32135] Needs Test: some uploads starts to fail with CGI.pm 3.29
Date: Mon, 3 May 2010 09:47:07 -0400
To: bug-CGI.pm [...] rt.cpan.org
From: Mark Stosberg <mark [...] summersault.com>
Show quoted text
> When I dumped @param, the parameter I was interested > in was 2nd, not 1st, and was being called in a scalar context, so the > fh returned was not correct. When I started calling 'upload' in a list > context, and looping through all filehandles, I got my data.
Thanks for the follow-up. This detail sounds like a behavior change by CGI.pm, but is the change fixing a bug that CGI.pm had before, triggering a "sleeper bug" in your code, or is the new behavior a bug in CGI.pm? Reviewing the Changelog may help to provide to provide insight into this. Mark
Considering resolved, after 3 more years have passed with no one else adding even a "me too" comment, and no formal automated test submitted which confirms the issue is still present. Please re-open if issue is still reproducible.