http://qs321.pair.com?node_id=182674


in reply to CGI file upload - endless loop??

It may very well be just a timeout problem like joealba said, but your perl code could be the problem. (Your HTML form looks fine.) To elaborate:

When you submit a multipart form, your browser packages up the file you specified in the file field and sends it along in the HTTP request to the server. So the initial request is when the actual transfer takes place, which can make it appear that it's hung, when it's really just still sending. CGI.pm reads in the file, and places it in a temp file. Only then is your program really able to spit headers and content back to the browser. So if it's a big file and you're on a modem, it will appear to hang, and may even time out.

(You don't have to process the file, it will just be deleted if you don't.) Try a simple CGI response like:

#!/usr/bin/perl -w use strict; use CGI; my $q = new CGI; print $q->header(); if ($q->param()) { print $q->ul( 'Got Something:', $q->li( [map {"$_: ".$q->param($_)} $q->param()] ) ); } else { print 'Got squat, sorry'; }

Anyway, go ahead and post your code, someone will be able to spot the breaking point if there is one.

PS, I have noticed that in particular IE 5.5 on MacOS seems to have trouble sometimes with all of my CGI.pm-based upload scripts. If that's your OS, you might try debugging from another machine to be sure it's not a client-specific problem.