Gossamer Forum
Home : Products : DBMan : Customization :

remove spaces from uploaded files how? ( file upload mod )

Quote Reply
remove spaces from uploaded files how? ( file upload mod )
I have the file upload mod working (multiple file upload mod version installed for future, but for now just using it for one upload per record...)

I also am trying to integrate imagemagick to do thumbnails, which works except one thing: when somone uploads a file with a space in the name, imagemagick can't find the file.

I've used the following code which I got from the forum here to strip commas and dollar signs from prices so that they are all on level playing field:

$in{'price'} =~ s/,//g; ### remove comma from entry
$in{'price'} =~ s/\$//g; ### remove dollar sign from entry

However I don't seem to have any luck applying something like:

$in{'file-to-upload-1'} =~ s/ //g; ### remove space from filename

or

$in{'filename'} =~ s/ //g; ### remove space from filename

Doens't do anything and the upload file saved on the local test server still has the spaces in it and the browser shows it as image%20name and imagemagick can't find it to do the thumbnail.

I tried adding those lines to the top of sub validate_upload { and then with no luck above the line:

$filename = $1;

and then with no luck above

push(@Files_Written, "$SAVE_DIRECTORY\/$newdirname\/$filename");

and also in the sub add_record { itself.

Any ideas on how to strip the spaces from filenames people upload using hte multi-file upload mod?

Thanks very much in advance.
Subject Author Views Date
Thread remove spaces from uploaded files how? ( file upload mod ) beaverbeacon 6333 Sep 7, 2003, 11:06 PM
Thread Re: [beaverbeacon] remove spaces from uploaded files how? ( file upload mod )
Watts 6261 Sep 8, 2003, 11:24 AM
Thread Re: [Watts] remove spaces from uploaded files how? ( file upload mod )
beaverbeacon 6257 Sep 8, 2003, 12:58 PM
Post Re: [beaverbeacon] remove spaces from uploaded files how? ( file upload mod )
LoisC 6241 Sep 9, 2003, 10:50 AM
Thread Re: [beaverbeacon] remove spaces from uploaded files how? ( file upload mod )
chmod 6227 Sep 10, 2003, 1:53 AM
Thread Re: [chmod] remove spaces from uploaded files how? ( file upload mod )
beaverbeacon 6221 Sep 10, 2003, 2:08 AM
Post Re: [beaverbeacon] remove spaces from uploaded files how? ( file upload mod )
Watts 6229 Sep 10, 2003, 8:27 AM