Ask a Question related to Macromedia ColdFusion, Design and Development.
-
kbuska525 #1
#CFFILE.serverFile# returns %20 for files with a space
I'm trying to upload a file and then display a thumbnail of the item. This
works fine except when upload files with a space in the name. I get a red x
letting me know if couldn't find foo%x0bar.jpg. The title of the image is foo
bar.jpg
What do I need to remove spaces from Files?
Thank you,
Ken
kbuska525 Guest
-
#40633 [NEW]: disk_free_space returns a bad result on filesystems with negative free space
From: adam-phpbugs at adam dot gs Operating system: *BSD (at least) PHP version: 5.2.1 PHP Bug Type: Filesystem function... -
How to use CFFILE to rename files
I tired the following and got error, please help! All I need is appending all the files within FolderA with "Version1_" in front of the file name... -
Using CFFILE on compiled CFM files
I have a CFM template that renames another CFM template using CFFILE. This works fine until I compile the templates using the cfcompile tool.... -
cffile upload file field returns temporary path
Hi, I'm attempting to use cffile upload and the FORM file field is being returned as ... -
CFFile won't delete files
I have a list of articles in my knowledgebase some of which are totally web based and others are DOC or PDF files.... The admin is allowed to... -
kbuska525 #2
#CFFILE.serverFile# returns %20 for files with a space
I'm trying to upload a file and then display a thumbnail of the item. This
works fine except when upload files with a space in the name. I get a red x
letting me know if couldn't find foo%x0bar.jpg. The title of the image is foo
bar.jpg
What do I need to remove spaces from Files?
Thank you,
Ken
kbuska525 Guest
-
Fernis #3
Re: #CFFILE.serverFile# returns %20 for files with aspace
I don't have CF at hand right now, so I reserve the right to be wrong, but here
goes:
Are you sure CFFILE.serverfile really contains the "%20"? Maybe you're just
seeing it in the browser?
If the file name has a space, but your browser cannot show it with <img
src="#CFFILE.serverFile">, you can try to display your images like this: <img
src="#urlencodedformat(CFFILE.serverFile)#">
If the case is vice versa, i.e. the CFFILE.serverFile would actually contain
the "%20" (I doubt it), <img src="#replace(CFFILE.serverFile,"%20","
","all")#"> could do the trick.
But the best practice, in my opinion, is to replace the spaces with
underscores "_" right after the upload. Use find() to check if there are spaces
in the file name, and <CFFILE action="rename" ....> after that ,if necessary.
Furthermore, you findoneof() and replacelist() are very useful functions, if
you want to check for more special characters, and replace them with something
else. It's a good habit to check for ? ? ? ? etc. (in case you can't see the
characters, they were a o u with umlauts, and a with acute) , and change these
to a o u a accordingly. Just to begin with.
Fernis Guest
-
jdeline #4
Re: #CFFILE.serverFile# returns %20 for files with aspace
If I take your filename literally, foo%x0bar.jpg is not a valid name, since x0 is not a valid hex number. Do you mean foo%20bar.jpg?
jdeline Guest
-
Unregistered #5
#CFFILE.serverFile# returns %20 for files with a space
If the actual file has a space but your code has a "%20 then use:
URLDecode(FileNameVariable);
If not, then somewhere upstream during the naming of the file the name is being URL encoded. Use the above code there to fix it.Unregistered Guest



Reply With Quote

