Gossamer Forum
Home : Products : Gossamer Links : Discussions :

bug in fileupload with spaces in filename

Quote Reply
bug in fileupload with spaces in filename
Hi there,

Often users attempt to upload images with spaces in their filename.

The database stores the image exactly as it is named on the user system.
However, Linksql stores the image on the server with spaces converted to %20;

When I attempt to access the filename based on the data found in Links_Files.

The system attempts to call a file named:
"http://mydomain.com/somefilename withspace.jpg"

instead of:
http://mydomain.com/...name%20withspace.jpg

But even that won't work because since the filename is coded with %20, we can't request
http://mydomain.com/...name%20withspace.jpg

instead we have to request:
http://mydomain.com/somefilename%2520withspace.jpg
because %20 means space and %2520 means %20


Where would we fix this in 2.1.2
Can this be fixed in the next release?
Wouldn't it be easiest to convert all funky characters to _ and save the file and filename to the server accordingly as is done when creating directory names?

Thank you in advance for any suggestions on fixing this.

peace.

klangan
Quote Reply
Re: [klangan] bug in fileupload with spaces in filename In reply to
You may use this function to revert back the escaped chars:
GT::CGI::unescape($filename)

I don't know what file upload feature you use, but in case it's a plugin, like the Attachment plugin, this should be corrected in the plugin itself.


BTW: I don't really prefer allowing untrusted users to upload filenames using their own filenames. You may use an internal filename, like <%link_ID%>_<%num%>.<%ext%>, where 'num' is a serial number, and 'ext' is extension. Filenames can be simulated by virtual filenames, which are not real names of uploaded files, but are displayed, when user manages the uploaded files.

Best regards,
Webmaster33


Paid Support
from Webmaster33. Expert in Perl programming & Gossamer Threads applications. (click here for prices)
Webmaster33's products (upd.2004.09.26) | Private message | Contact me | Was my post helpful? Donate my help...