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

Need the path to upload file

New Here ,
May 20, 2008 May 20, 2008
I have a non CF form with an input element type of file. The form passes and uploads the file correctly, however the path when <cfoutput> is a temp path. not the actually path from the users machine. I need the actually file name to store in the database. form.doc1 is not the actually path. Thanks.
256
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 , May 20, 2008 May 20, 2008
contrary to what Ian says, you CAN get the user's path to file with a
bit of javascript... but WHY? why do you need that path? it has no
relevance to YOUR server paths. it is of no use to you.

if all you need is the NAME of uploaded file, then CFFILE.SERVERFILE is
your friend. CFFILE action="upload" returns a nice structure with lots
of useful data - look it up in the docs.



Azadi Saryev
Sabai-dee.com
http://www.sabai-dee.com/
Translate
LEGEND ,
May 20, 2008 May 20, 2008
headjava wrote:
> I need the actually file name to
> store in the database. form.doc1 is not the actually path. Thanks.
>

Why?

I'm not going to give that path to you?

Here, I'll fake a path for you?

In other words. Nope you can NOT get the path from the client machine
where a file was uploaded from. The browser does not send it, the web
server does not receive it and ColdFusion does not want it. This would
be a huge security hole if such a thing was allowed, and the smart
people who amended the http protocol to upload files said NO WAY.

IF you are in such an environment where users can be required to
download software to circumvent such precautions there are supposedly
active-X controls that can provide a more direct connection between
client and server and provide this type of invasive data.

But other then that, you are out of luck here.
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 ,
May 20, 2008 May 20, 2008
contrary to what Ian says, you CAN get the user's path to file with a
bit of javascript... but WHY? why do you need that path? it has no
relevance to YOUR server paths. it is of no use to you.

if all you need is the NAME of uploaded file, then CFFILE.SERVERFILE is
your friend. CFFILE action="upload" returns a nice structure with lots
of useful data - look it up in the docs.



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
New Here ,
May 21, 2008 May 21, 2008
LATEST
Thanks for the replies. As I stated, I just need the upload filename, I wrongly assumed I needed the path to extract the filename. I developed apps on an IBM web product Net.Data and thats how I had to do it. CFFILE. is my friend.
Thanks again.
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