Upload File from Client to Server (not using HTMLInputFile)

Discussion in 'ASP .Net' started by Chris, Jan 31, 2007.

  1. Chris

    Chris Guest

    Hello,

    I am using asp.net. I have been searching this for a while, but dint
    find any solution yet. Any help will be appreciated.

    I have a string variable say 'myFile' that has complete path of a file
    located in client machine. eg:
    Dim myFile as string = "C:/myFolder/File1.txt"

    Clicking on a button should copy that file from local client to a
    location in the server.

    I am familiar with 'HtmlInputFile', but the property 'PostedFile' is
    readonly. I can not assign my 'myFile' variables value to it. I am not
    using HTMLInputFile b'coz I dont want to store the file when I select
    it after browsing. I am storing it in a string variable and later on
    (in the end), I have to save/upload it in the server.

    Thanks,
    Chris
     
    Chris, Jan 31, 2007
    #1
    1. Advertising

  2. Chris

    Tim Mackey Guest

    hi chris
    browsers implement very tight security when it comes to client file system
    security.
    as the developer you cannot decide which file the user will upload. and for
    very good reason, imagine if you could retrieve my outlook PST file just
    because i browsed to your site by mistake?
    fortunately it is not possible to do what you asked. you may want to look
    at a windows forms client which can be run with full access to the client
    file system. if the user launches your app with full trust, then you can do
    whatever you like with their files.

    good luck
    tim

    "Chris" <> wrote in message
    news:...
    > Hello,
    >
    > I am using asp.net. I have been searching this for a while, but dint
    > find any solution yet. Any help will be appreciated.
    >
    > I have a string variable say 'myFile' that has complete path of a file
    > located in client machine. eg:
    > Dim myFile as string = "C:/myFolder/File1.txt"
    >
    > Clicking on a button should copy that file from local client to a
    > location in the server.
    >
    > I am familiar with 'HtmlInputFile', but the property 'PostedFile' is
    > readonly. I can not assign my 'myFile' variables value to it. I am not
    > using HTMLInputFile b'coz I dont want to store the file when I select
    > it after browsing. I am storing it in a string variable and later on
    > (in the end), I have to save/upload it in the server.
    >
    > Thanks,
    > Chris
    >
     
    Tim Mackey, Jan 31, 2007
    #2
    1. Advertising

  3. Chris

    Mark Rae Guest

    "Chris" <> wrote in message
    news:...

    > Clicking on a button should copy that file from local client to a
    > location in the server.


    You must be joking!

    > I am familiar with 'HtmlInputFile', but the property 'PostedFile' is
    > readonly. I can not assign my 'myFile' variables value to it.


    And a damn good thing too!!!
     
    Mark Rae, Jan 31, 2007
    #3
  4. Chris

    bruce barker Guest

    see previous reply. there is no way other than an active/x control. as
    this control will be inherently unsafe, you probably can not find one to
    buy, so you will have to build it.

    also while this control could be written in .net, as its unsafe, the
    user would have to mark it as trusted for it to be able to access the
    file system.


    -- bruce (sqlwork.com)


    Chris wrote:
    > Hello,
    >
    > I am using asp.net. I have been searching this for a while, but dint
    > find any solution yet. Any help will be appreciated.
    >
    > I have a string variable say 'myFile' that has complete path of a file
    > located in client machine. eg:
    > Dim myFile as string = "C:/myFolder/File1.txt"
    >
    > Clicking on a button should copy that file from local client to a
    > location in the server.
    >
    > I am familiar with 'HtmlInputFile', but the property 'PostedFile' is
    > readonly. I can not assign my 'myFile' variables value to it. I am not
    > using HTMLInputFile b'coz I dont want to store the file when I select
    > it after browsing. I am storing it in a string variable and later on
    > (in the end), I have to save/upload it in the server.
    >
    > Thanks,
    > Chris
    >
     
    bruce barker, Feb 1, 2007
    #4
  5. Chris

    Chris Guest

    On Jan 31, 5:19 pm, bruce barker <> wrote:
    > see previous reply. there is no way other than an active/x control. as
    > this control will be inherently unsafe, you probably can not find one to
    > buy, so you will have to build it.
    >
    > also while this control could be written in .net, as its unsafe, the
    > user would have to mark it as trusted for it to be able to access the
    > file system.
    >
    > -- bruce (sqlwork.com)
    >
    >
    >
    > Chris wrote:
    > > Hello,

    >
    > > I am using asp.net. I have been searching this for a while, but dint
    > > find any solution yet. Any help will be appreciated.

    >
    > > I have a string variable say 'myFile' that has complete path of a file
    > > located in client machine. eg:
    > > Dim myFile as string = "C:/myFolder/File1.txt"

    >
    > > Clicking on a button should copy that file from local client to a
    > > location in the server.

    >
    > > I am familiar with 'HtmlInputFile', but the property 'PostedFile' is
    > > readonly. I can not assign my 'myFile' variables value to it. I am not
    > > using HTMLInputFile b'coz I dont want to store the file when I select
    > > it after browsing. I am storing it in a string variable and later on
    > > (in the end), I have to save/upload it in the server.

    >
    > > Thanks,
    > > Chris- Hide quoted text -

    >
    > - Show quoted text -


    That makes sense. I can not use windows application. It has to be web
    app. I'll try something else.
    Thanks for your help !! I appreciate it.
     
    Chris, Feb 2, 2007
    #5
    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. Ariel Dolan
    Replies:
    5
    Views:
    4,211
    Patrice Scribe
    Feb 24, 2004
  2. Long Le
    Replies:
    3
    Views:
    1,180
    Long Le
    Aug 11, 2004
  3. hust6
    Replies:
    2
    Views:
    18,196
  4. Replies:
    0
    Views:
    557
  5. Replies:
    1
    Views:
    973
    Gabriel Genellina
    Nov 25, 2006
Loading...

Share This Page