Skip to main content
Participant
May 20, 2008
Answered

Need the path to upload file

  • May 20, 2008
  • 2 replies
  • 305 views
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.
    This topic has been closed for replies.
    Correct answer Newsgroup_User
    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/

    2 replies

    Newsgroup_UserCorrect answer
    Inspiring
    May 21, 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/
    headjavaAuthor
    Participant
    May 21, 2008
    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.
    Inspiring
    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.