Http Request upload file

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Proogeren
    New Member
    • May 2007
    • 36

    #1

    Http Request upload file

    I have created a web application that allows the user to upload a file to the server. This works, but I also want to be able to use this from a application form. Could anyone please tell me how this can be done? Point me in the right direction

    Below is my working code for my aspx page
    [code=asp]
    <form id="form1" onsubmit="retur n Validate( this )" name="form1" method="post"
    action="http://test/upload.dll" enctype="multip art/form-data">
    <input type="hidden" name="accesstok en" value="fdsgsdfD GFdsfsd" />
    <input type="hidden" name="username" value="arnmob" />
    <input type="hidden" name="password" value="123" />

    <b>Upload File: </b>
    <input type="file" id="file" name="file" />&nbsp;
    <input type="submit" name="Submit" value="Upload" />&nbsp;
    </form>[/code]
    Last edited by Frinavale; Jul 10 '08, 01:58 PM. Reason: added [code] tags
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    If you want to upload a file to that web application from withen a windows application, then take a look at the HttpWebRequest object.
    It should provide the functionality you need.

    Comment

    • Proogeren
      New Member
      • May 2007
      • 36

      #3
      Yes I figured out ;) But I am struggeling a bit figuring out how I can add the
      <input type="hidden" name="accesstok en" value="fdsgsdfD GFdsfsd" />
      <input type="hidden" name="username" value="arnmob" />
      <input type="hidden" name="password" value="123" />

      parameters to the HttpWebRequest request object. There are not set metods on the object to add these? These need to be added to authenticate the user.

      I appreciate the help

      Comment

      • Plater
        Recognized Expert Expert
        • Apr 2007
        • 7872

        #4
        You would have to make sure that HttpWebRequest method was set to "POST". There is an example of how to send the parameter data to the request stream on msdn.

        Comment

        Working...