Gossamer Forum
Home : Products : DBMan SQL : Discussion :

File Upload

Quote Reply
File Upload
Just curious - has anybody got the upload module to work successfully on a Windows 2000/Apache machine?

If so how? And do you care to share the secret to your success?

I am really getting at end of the line trouble shooting this one.

Thanks to all for help to date.
John

Quote Reply
Re: File Upload In reply to
When I Modify a record the Mod/Script works. If I Add a new record the upload converts the file name to ".gif/.jpg" and destroys all other picture files.

I am almost sure this problem is occurring in the validate_upload subroutine.

Help!

Quote Reply
Re: File Upload In reply to
Please don't post duplicate threads on the same topic - it makes it harder for people to find relevant information when searching.

Paul
Installations:http://wiredon.net/gt/
Support: http://wiredon.net/forum/

Quote Reply
Re: File Upload In reply to
And I already responded to your duplicate Thread...

Regards,

Eliot Lee
Quote Reply
Re: File Upload In reply to
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