Re: System.Net.WebClient and UploadFile() Problem

Discussion in 'ASP .Net' started by George Ter-Saakov, Oct 10, 2006.

  1. You can not simply upload file on a server.
    Something should wait for that file at the server end.

    So url http://sdtpcal.someserver.com/Federation/Databases/Federation.Zip to
    download file looks correct.

    but to upload you must write an ASPX page that will accept file and save to
    the folder on a server.

    George.


    "Amos Soma" <> wrote in message
    news:...
    >I am using WebClient to upload a file to a remote server. The call I'm
    >making looks as follows:
    >
    > webClient.UploadFile("http://sdtpcal.someserver.com/Federation/Databases/Federation.Zip",
    > @"C:\Temp\Federation.Zip");
    >
    > 'Federation' is a virtual directory on the server I'm attempting to upload
    > the file to. The URL is valid and the file I'm attempting to transfer
    > exists. I keep getting 404 errors (not found). It's not clear to me
    > exactly what cannot be found. If I attempt to download this exact file
    > from the same exact URL using webClient.DownloadFile, it works fine!
    >
    > Thanks for the help - Amos.
    >
    >
    George Ter-Saakov, Oct 10, 2006
    #1
    1. Advertising

  2. George Ter-Saakov

    Joerg Jooss Guest

    Thus wrote George Ter-Saakov,

    > You can not simply upload file on a server.
    > Something should wait for that file at the server end.
    > So url
    > http://sdtpcal.someserver.com/Federation/Databases/Federation.Zip to
    > download file looks correct.
    >
    > but to upload you must write an ASPX page that will accept file and
    > save to the folder on a server.


    You only need a web application endpoint for POST requests. If the OP can
    use PUT, the web server may support this without any special user code (IIS
    does for sure).

    Both WebClient.UploadFile(uri, "PUT", fileName) and WebClient.OpenWrite(uri,
    "PUT") will do the trick.

    Cheers,
    --
    Joerg Jooss
    Joerg Jooss, Oct 11, 2006
    #2
    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. belfast neil

    webclient.uploadfile application question

    belfast neil, Jul 28, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    441
    belfast neil
    Jul 28, 2003
  2. David W

    Problems with WebClient.UploadFile

    David W, Oct 29, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    783
    David W
    Oct 29, 2003
  3. Phillip N Rounds

    File Upload issues with WebClient.UploadFile

    Phillip N Rounds, Feb 2, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    11,319
    Bruce Barker
    Feb 2, 2006
  4. UJ
    Replies:
    2
    Views:
    2,060
    Joerg Jooss
    Sep 16, 2006
  5. Scott Trick
    Replies:
    10
    Views:
    811
    Martin M
    Oct 12, 2009
Loading...

Share This Page