sstevens has asked for the wisdom of the Perl Monks concerning the following question:
The problem is that nothing is displayed until the file upload has completed, then the forking all works (it does the meta refresh and everything). There must be a way for the uploading to take place in the background, but I can't figure it out. Any help would really be appreciated!#!/usr/local/bin/perl $|++; use CGI; my $req = new CGI; if (-f "temp.txt") { print "Content-type: text/html\n\n"; print "done!\n"; unlink("temp.txt"); exit(0); } my $pid = fork(); if ($pid == 0) { print "Content-type: text/html\n\n"; print "<META HTTP-EQUIV='Refresh' CONTENT='2'>\n"; print "working...\n"; exit(0); } else { $file = $req->param("file"); # yeah, I'll change this later open (OUTFILE, ">temp.jpg"); while (my $bytesread = read($file, my $buffer, 1024)) { print OUTFILE $buffer; } close (OUTFILE); open(TEMP, ">temp.txt"); print TEMP "fdas\n"; close(TEMP); waitpid($pid,0); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: forking large file uploads
by pc88mxer (Vicar) on Jan 23, 2008 at 08:45 UTC | |
by sstevens (Scribe) on Jan 23, 2008 at 14:14 UTC | |
|
Re: forking large file uploads
by hipowls (Curate) on Jan 23, 2008 at 02:04 UTC | |
|
Re: forking large file uploads
by kyle (Abbot) on Jan 23, 2008 at 15:52 UTC |