asp:FileUpload seems to give me the filename but not the complete path.

Discussion in 'ASP .Net' started by AAaron123, Sep 10, 2009.

  1. AAaron123

    AAaron123 Guest

    <asp:FileUpload> seems to give me the filename but not the complete path.

    I'm guessing that it a security thing and I can't get it.

    Is that correct?



    Thanks
    AAaron123, Sep 10, 2009
    #1
    1. Advertising

  2. AAaron123

    AAaron123 Guest

    AAaron123 wrote:
    > <asp:FileUpload> seems to give me the filename but not the complete
    > path.
    >
    > I'm guessing that it a security thing and I can't get it.
    >
    > Is that correct?
    >
    >
    >
    > Thanks


    Looks like IE8 remove the path.

    I was just listing it any way.
    AAaron123, Sep 10, 2009
    #2
    1. Advertising

  3. AAaron123

    Patrice Guest

    Hi,

    > Looks like IE8 remove the path.


    Correct and the edit box should be read only.

    See
    http://blogs.msdn.com/ie/archive/2008/07/02/ie8-security-part-v-comprehensive-protection.aspx
    and the "File Upload Control" section :

    "Additionally, the "Include local directory path when uploading files"
    URLAction has been set to "Disable" for the Internet Zone. This change
    prevents leakage of potentially sensitive local file-system information to
    the Internet. For instance, rather than submitting the full path
    C:\users\ericlaw\documents\secret\image.png, Internet Explorer 8 will now
    submit only the filename image.png."

    --
    Patrice
    Patrice, Sep 10, 2009
    #3
  4. AAaron123

    AAaron123 Guest

    Patrice wrote:
    > Hi,
    >
    >> Looks like IE8 remove the path.

    >
    > Correct and the edit box should be read only.
    >
    > See
    > http://blogs.msdn.com/ie/archive/2008/07/02/ie8-security-part-v-comprehensive-protection.aspx
    > and the "File Upload Control" section :
    >
    > "Additionally, the "Include local directory path when uploading files"
    > URLAction has been set to "Disable" for the Internet Zone. This change
    > prevents leakage of potentially sensitive local file-system
    > information to the Internet. For instance, rather than submitting the
    > full path C:\users\ericlaw\documents\secret\image.png, Internet
    > Explorer 8 will now submit only the filename image.png."


    As an aside:
    You can copy it with javascript on the onclientclick event into something,
    but you get someting like:

    C:/fakefolder/filename.txt

    Cute

    I only listed it as info because the controls text box gets cleared after
    the upload.
    Got a supprise when it stoped working.

    Thanks
    AAaron123, Sep 10, 2009
    #4
  5. AAaron123

    april198474

    Joined:
    Sep 17, 2009
    Messages:
    4
    hi,

    string filePath=FileUpload1.PostedFile.FileName;
    string fileName = FileUpload1.FileName;

    filePath is the path of the File, while fileName is the file name.


    Comm100
    _______________
    Free chat software for you
    Microsoft Certified Partner
    .comm100.com
    april198474, Sep 22, 2009
    #5
  6. AAaron123

    Martin M Guest

    Try XUploader from www.springsys.com, it's nice.


    > <asp:FileUpload> seems to give me the filename but not the complete path.
    >
    > I'm guessing that it a security thing and I can't get it.
    >
    > Is that correct?
    >
    >
    >
    > Thanks
    >
    Martin M, Oct 12, 2009
    #6
  7. AAaron123

    AAaron123 Guest

    I check that out.

    thanks


    Martin M wrote:
    > Try XUploader from www.springsys.com, it's nice.
    >
    >
    >> <asp:FileUpload> seems to give me the filename but not the complete
    >> path.
    >>
    >> I'm guessing that it a security thing and I can't get it.
    >>
    >> Is that correct?
    >>
    >>
    >>
    >> Thanks
    AAaron123, Oct 13, 2009
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Gunter Hansen
    Replies:
    12
    Views:
    24,024
  2. Karl
    Replies:
    0
    Views:
    332
  3. Oren
    Replies:
    1
    Views:
    527
    Michael D. Ober
    Apr 29, 2007
  4. David Thielen

    Major problem with FileUpload if bad filename

    David Thielen, Mar 20, 2006, in forum: ASP .Net Web Controls
    Replies:
    20
    Views:
    346
  5. David Thielen

    FileUpload - keep the filename

    David Thielen, Mar 22, 2006, in forum: ASP .Net Web Controls
    Replies:
    5
    Views:
    1,235
    Steven Cheng[MSFT]
    Mar 23, 2006
Loading...

Share This Page