Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Using a Forward Slash (/) in CFFILE Destination

Guest
Feb 26, 2007 Feb 26, 2007
Hi everyone,
I couldn't find this anywhere in the forums (at least not searching for "cffile forward slash", "cffile /", or "cffile destination") and hope I'm posting this in the correct place (please let me know if not). I need to use a forward slash (/) in the name of a file using cffile, but when I try to set destination = "c:\directory\file/name.txt" cf throws an exception and tells me that the system can't find the "c:\directory\file\" directory. Is there a way to froce ColdFusion to interpret the forward slash as part of the file name instead of a directory structure character? By the way I'm using ColdFusion 6.1 Standard Edition on a Windows box (obviously).
TOPICS
Getting started
2.8K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Feb 26, 2007 Feb 26, 2007
One can actually use forward slashes in file names in *nix systems. It's
clever enough to be able to differentiate between "part of a file name",
and "part of the path". From memory, one needs to enclose the file name in
quotes or some other delimter, though.

But one *cannot* use a fwd slash on Windows.

--
Adam
Translate
LEGEND ,
Feb 26, 2007 Feb 26, 2007
what's the action of cffile? read? upload?
i think with action=read you may be able to use URLEncodedFormat() on
the file name to get over the issue (I can't test it, though, since
windows won't let you save a file with / in the name...)

with action=upload i am afraid there is no way to fool CF...

how did you end up with such file name anyway?

--

Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Feb 26, 2007 Feb 26, 2007
Thanks for the quick reply.

It's unfortunately a naming convention for the system to which the file is being uploaded. In the original cffile tag, the action attribute was set to write. The end result of the script is an upload to a remote server using cfftp. I got as far as realizing I could name the file something different on my server (which is working) and then name it according to the naming convention in cfftp (which isn't working). So now I'm trying to use <cfftp action="putfile" remotfile="file/name.txt"> which is returning:

An exception occurred when performing the FTP putfile operation.

The cause of this exception was that: 550 rename: No such file or directory. .

I've also tried putting the file with the working file name and then using <cfftp action="rename" new="file/name.txt"> but it's giving me the same error (in other words, the remote server seems to be searching for the "/file/" directory). Is there anything I can do within the script to fix this or is this an inherent limitation of ftp?

Any ideas?
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 26, 2007 Feb 26, 2007
Almal wrote:
> Thanks for the quick reply.
>
> It's unfortunately a naming convention for the system to which the file is
> being uploaded.

very strange.... are you sure about that? as Adam said, a forward (or
backward) slash is not a legal character in a file name, at least not on
any systems i know...

can you connect to your remopte system with an ftp program and try to
create anew file there with a / in its name? or rename an existing file
to add a / in its name? i suspect that will not be allowed...

please make sure you are not misinterpreting some instructions re naming
conventions on your remote system...


--
Azadi Saryev
Sabai-dee.com
Vientiane, Laos
http://www.sabai-dee.com
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 26, 2007 Feb 26, 2007
Almal wrote:
> Thanks for the quick reply.
>
> It's unfortunately a naming convention for the system to which the file is
> being uploaded.

very strange.... are you sure about that? as Adam said, a forward (or
backward) slash is not a legal character in a file name, at least not on
any systems i know...

can you connect to your remopte system with an ftp program and try to
create anew file there with a / in its name? or rename an existing file
to add a / in its name? i suspect that will not be allowed...

please make sure you are not misinterpreting some instructions re naming
conventions on your remote system...


--
Azadi Saryev
Sabai-dee.com
Vientiane, Laos
http://www.sabai-dee.com
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Feb 26, 2007 Feb 26, 2007
quote:

Originally posted by: Newsgroup User
Almal wrote:
> Thanks for the quick reply.
>
> It's unfortunately a naming convention for the system to which the file is
> being uploaded.

very strange.... are you sure about that? as Adam said, a forward (or
backward) slash is not a legal character in a file name, at least not on
any systems i know...



That was always my understanding also, at least on *nix systems (I'm not too familiar with Windows). I assumed they were using some sort of file system in which you could use it, but doing a little more research it doesn't seem to be a legal file name character on any Windows systems either. I'm going to contact them and let them know. This is looking more and more like a mistake on their end (and my end for not doing my Windows research).

By the way, just to clarify, the file needs to be named according to an encoded ID that happens to have a forward slash in it.

Thanks for the responses, I will post to let you know the outcome and mark this as answered.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 26, 2007 Feb 26, 2007
One can actually use forward slashes in file names in *nix systems. It's
clever enough to be able to differentiate between "part of a file name",
and "part of the path". From memory, one needs to enclose the file name in
quotes or some other delimter, though.

But one *cannot* use a fwd slash on Windows.

--
Adam
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Feb 26, 2007 Feb 26, 2007
quote:

Originally posted by: Newsgroup User
One can actually use forward slashes in file names in *nix systems. It's
clever enough to be able to differentiate between "part of a file name",
and "part of the path". From memory, one needs to enclose the file name in
quotes or some other delimter, though.

But one *cannot* use a fwd slash on Windows.

--
Adam



Ah, good to know. I tried testing it in pico on a bsd system and you definitely can't save directly with a forward slash in the file name but the delimeters seem to work. Also, I got the server receiving the file to allow a file name with no forward slash, so problem solved.

Thanks for all your help, marking the above response as the answer.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 26, 2007 Feb 26, 2007
quote:

Originally posted by: Newsgroup User
One can actually use forward slashes in file names in *nix systems. It's
clever enough to be able to differentiate between "part of a file name",
and "part of the path". From memory, one needs to enclose the file name in
quotes or some other delimter, though.
But one *cannot* use a fwd slash on Windows.


When I read this thread this morning, I tried to create a/b or something like that on aix using vi. It wouldn't let me.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 26, 2007 Feb 26, 2007
A fwd slash is not a legal character in a file name.

--
Adam
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 26, 2007 Feb 26, 2007
I just tried again. The os is AIX 5.2

I could never get a forward slash into a file name. This is not surprising because unix uses forward slashes for addressing. I tried escaping with single quotes, double quotes, one backslah and two backslashes

I could get a backslash into a name by escaping it with another one. But that wasn't the original question.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Feb 26, 2007 Feb 26, 2007
Just tried doing it with mv and cp on OSX (which is BSD based) and there doesn't appear to be any way to do it from the command line. In reference to using delimeters to do it, I was doing it from OSX and didn't notice that the forward slash was replaced with a colon (:) in the actual filename. So apparently you can not use forward slashes even if you escape them or enclose the file name in quotes, at least on BSD.

Thanks again, all.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 27, 2007 Feb 27, 2007
I could be wrong on that. I was not going on personal experience, just
something that stuck in my mind when reading something. I cannot find the
URL @ present, but I'm sure I read that the only actual *illegal* character
in a *nix file name is the NULL character. But experience trumps reading.

The best I could find is this:
http://www.microsoft.com/technet/prodtechnol/windows2000serv/reskit/iisbook/c03_converting_unix_file...

Although that is not where I originally read it.

--
Adam
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Feb 27, 2007 Feb 27, 2007
quote:

Originally posted by: Newsgroup User
I could be wrong on that. I was not going on personal experience, just
something that stuck in my mind when reading something. I cannot find the
URL @ present, but I'm sure I read that the only actual *illegal* character
in a *nix file name is the NULL character. But experience trumps reading.

The best I could find is this:
http://www.microsoft.com/technet/prodtechnol/windows2000serv/reskit/iisbook/c03_converting_unix_file...

Although that is not where I originally read it.

--
Adam



The above sounds right and seems to be generally correct in practice (I'm testing by transferring files from OSX to Windows), with the exception of the "/" character. It's possible that "/" isn't, in fact, illegal to a *nix OS, but just isn't valid as a file name in any applications (including those that ship wtih the OS).

However, It's also possible (read: probable) that I have no idea what I'm talking about. I'll see what I can find and post it here, would be good to know as I'm sure others have run into this (and I'm sure this won't be the last time I'm given a ridiculous naming convention).
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 27, 2007 Feb 27, 2007
check these out:

http://www.portfoliofaq.com/pfaq/FAQ00352.htm

and

http://www.grouplogic.com/Knowledge/index.cfm?fuseaction=view&docID=111

still trying to find a full list for *nix...

--

Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 27, 2007 Feb 27, 2007
LATEST
found this too:
http://en.wikipedia.org/wiki/File_name

--

Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources