Anybody have a solution?
When an uploaded file is Added, it renames the file to the id number of the record. However, it destroys all files in the folder and renames the file something like ".gif" or ".jpg". We believe a contribution to the problem is found in the validate_upload subroutine. We commented out various lines to test.
What specifically is the $file = $1; line doing?
Also I don't quite understand
$extlength = length($filename) - index($filename,".");
The entire program fails when removing the "."
We are using Windows and maybe this contributes to some problem
File: db.cgi
sub validate_upload
if ($filekey =~ /([^\/\\]+)$/) {
$filename = $1;
$extlength = length($filename) - index($filename,".");
$filename = $newfilename . lc(substr($filename,-$extlength,$extlength));
unless ($filename =~ /$ALLOWED_EXT/) {
$ALLOWED_EXT =~ s/\\//g;
$ALLOWED_EXT =~ s/\$//g;
@ext = split (/\Q|\E/o,$ALLOWED_EXT);
$ALLOWED_EXT = join(" or ",@ext);
return "Only files with the following extension(s) are allowed: $ALLOWED_EXT";
}
}
------------------
Many thanks
John
When an uploaded file is Added, it renames the file to the id number of the record. However, it destroys all files in the folder and renames the file something like ".gif" or ".jpg". We believe a contribution to the problem is found in the validate_upload subroutine. We commented out various lines to test.
What specifically is the $file = $1; line doing?
Also I don't quite understand
$extlength = length($filename) - index($filename,".");
The entire program fails when removing the "."
We are using Windows and maybe this contributes to some problem
File: db.cgi
sub validate_upload
if ($filekey =~ /([^\/\\]+)$/) {
$filename = $1;
$extlength = length($filename) - index($filename,".");
$filename = $newfilename . lc(substr($filename,-$extlength,$extlength));
unless ($filename =~ /$ALLOWED_EXT/) {
$ALLOWED_EXT =~ s/\\//g;
$ALLOWED_EXT =~ s/\$//g;
@ext = split (/\Q|\E/o,$ALLOWED_EXT);
$ALLOWED_EXT = join(" or ",@ext);
return "Only files with the following extension(s) are allowed: $ALLOWED_EXT";
}
}
------------------
Many thanks
John