eoin has asked for the wisdom of the Perl Monks concerning the following question:
If everything seems to be going well, you obviously don't know what the hell is going on.
#!/usr/bin/perl -w use strict; use warnings; use diagnostics; use CGI; my %pics; my @pic_filehandles; my @filelist; my $key; my @files; my $upload_dir; my $q = CGI->new; my $user = $q->param("user"); my $album = $q->param("T1"); unless ( -d "./albums/$album" ) { mkdir( "./albums/$album", 0775 ); $upload_dir = "./albums/$album"; } { $pics{"pic$_"} = $q->param("photo$_") for 0..13; @pic_filehandles = map { $q->upload("photo$_") } '',0..13; } strip_filename(); sub strip_filename { my @allkeys = sort(keys(%pics)); foreach $key (@allkeys) { $pics{$key} =~ s/.*[\/\\](.*)/$1/; } } my $cntr = 0; @files = sort(keys(%pics)); foreach $key (@files) { open IMAGE, ">$upload_dir/$pics{$key}"; binmode IMAGE; while (<$pic_filehandles[$cntr]>) { print IMAGE; } close IMAGE; $cntr += 1; } print $q->header ( ); print <<END_HTML; <HTML> <HEAD> <TITLE>Thanks!</TITLE> </HEAD> <META HTTP-EQUIV="refresh" CONTENT="05;URL=http://eoinmurphy00.netfirm +s.com/cgi-bin/main.cgi?status=home&user=$user"> <title>Please Wait</title><head>Thank you for uploading your Photos.<b +ody>Please Wait<br>You will be redirected to the main page in 2 secon +ds.<br>Thank You $user</body> </HTML> END_HTML
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Upload problems
by cfreak (Chaplain) on Aug 13, 2003 at 13:16 UTC | |
|
Re: Upload problems
by rupesh (Hermit) on Aug 13, 2003 at 12:55 UTC | |
by chromatic (Archbishop) on Aug 13, 2003 at 17:28 UTC | |
by eoin (Monk) on Aug 14, 2003 at 10:45 UTC |