Forum Moderators: phranque
# the variables are set earlier, this is just for your reference to see how it's done
$old_pic = upload($_GET{'picID'});
open PIC, ">$cache_path/$pic";
binmode (PIC);
while ($bytes = read($old_pic,$data,16384)) { print PIC $data; }
close PIC; I first looked at php.ini. post_max_size is set to 50M, and upload_max_filesize is 50M. My uploads are done in Perl, anyway, but I wanted to make sure.
Any other suggestions on where I might be inadvertently limiting the file upload size?
perl has a similar global variable setting which you may want to explore - $CGI::POST_MAX
have you checked the web server error log file for clues?
# $SAVE_DIRECTORY = where to save file
sub GetUpload {
$| = 1;
use CGI qw(:standard);
$query = new CGI;
foreach $key (sort {$a <=> $b} $query->param()) {
#print "k: $key v: ". $query->param($key) . "<br>\n";
next if ($key =~ /^\s*$/);
next if ($query->param($key) =~ /^\s*$/);
next if ($key !~ /^file-to-upload-(\d+)$/);
$Number = $1;
if ($query->param($key) =~ /([^\/\\]+)$/) {
$Filename = $1;
$Filename =~ s/^\.+//;
$File_Handle = $query->param($key);
return(8);# if (!$ALLOW_INDEX && $Filename =~ /^index/i) {
} else {
$FILENAME_IN_QUESTION = $query->param($key);
return(7);# no filename
}
if (!open(OUTFILE, ">$SAVE_DIRECTORY\/$Filename")) {
chmod(0777, "$SAVE_DIRECTORY\/$Filename") if $operatingsystem eq "unix";
return(6); #print "There was an error opening the Output File\n";
}
undef $BytesRead;
undef $Buffer;
while ($Bytes = read($File_Handle,$Buffer,1024)) {
$BytesRead += $Bytes;
print OUTFILE $Buffer;
}
push(@Files_Written, "$SAVE_DIRECTORY\/$Filename");
$TOTAL_BYTES += $BytesRead;
$Confirmation{$File_Handle} = $BytesRead;
close($File_Handle);
close(OUTFILE);
}
$FILES_UPLOADED = scalar(keys(%Confirmation));
if ($TOTAL_BYTES > $MAXIMUM_UPLOAD && $MAXIMUM_UPLOAD > 0) {
foreach $File (@Files_Written) {
unlink $File;
}
return(5); #<TITLE>Error: Limit Reached</TITLE>
}
}