I am having trouble with uploading (.mp3) files that are about 3MB in size or bigger. The below code works great until I try to upload a large file. Any thoughts?
use CGI;
sub doUpload {
my ($buffer);
$query = new CGI;
$filename = $query->param("file");
$filename =~ s/.*[\/\\](.*)/$1/;
$myupload = $query->upload("file");
if ($filename =~ /.mp3/) {
open (UPLOADFILE, ">$dirpath/$filename");
while (read($myupload, $buffer, 1024)) {
print UPLOADFILE $buffer;
}
close (UPLOADFILE);
}
print "Location: $cgipath?action=success\nURI: $cgipath?action=success
+\n\n";
}
I have also tried it this way:
if ($filename =~ /.mp3/) {
open (UPLOADFILE, ">$dirpath/$filename");
while ( <$myupload> ) {
print UPLOADFILE;
}
close (UPLOADFILE);
}
Thanks.
-----------------------
I thought I got it working, but I didn't. It's not creating a file at all.
I added this to it:
$CGI::POST_MAX = 102400;
or 100MB. How do I check the return value of "OPEN"?