473,395 Members | 1,738 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

System.Net.WebClient and UploadFile() Problem

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.
Oct 10 '06 #1
2 6259
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/Federa...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" <am*********@yahoo.comwrote in message
news:Oq**************@TK2MSFTNGP03.phx.gbl...
>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.


Oct 10 '06 #2
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/Federa...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
ne********@joergjooss.de
Oct 11 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: David W | last post by:
I am trying to upload a file from a user's system to my web server. I found code using the WebClient.UploadFile method. However, the uploaded file is from the server's hard drive not the user's...
0
by: Saverio Tedeschi | last post by:
Hi all gurus, forgive me if I submit a 2nd post, but I'm no more able to see my question. So: I wrote an Win app with embedded FTP client (well, made some cut and paste from others' projects :-))...
2
by: marfi95 | last post by:
Hello all. I'm not sure if this is the correct place to post this, but if not please let me know. This is my situation. I have a simple problem, but am having problems doing this. I'm...
1
by: Phillip N Rounds | last post by:
I'm having problems using the WebClient.UploadFile() command. I have MySender.ASPX which is supposed to upload two files to the server. There is also ConsumeFileUpload.aspx which is intended to...
5
by: linn | last post by:
The 'Address' parameter in the WebClient.UploadFile usually comes in the form of ie. http://server/Upload_File.aspx Hence my question, what is exactly the content of this Upload_File.aspx? Am i...
2
by: Daniel | last post by:
As you may have guessed I'm trying to upload a file to a php server using the WebClient.UploadFile function, however the function never returns. Instead it chews up memory (fairly slowly) until it...
5
by: Svinja | last post by:
Hi, i am using WebClient.UploadFile to upload a file on my web page, code: WebClient webClient = new WebClient(); webClient.Credentials = new NetworkCredential(userName, pass);...
6
by: =?Utf-8?B?U2NvdHQgVHJpY2s=?= | last post by:
I followed the instructions from MSDN for Webclient UploadFile and I get an error: Could not find file 'C:\testfile.xls'. If I add the file (c:\testfile.xls) to the server I do not get the error...
5
by: benmess | last post by:
This code snippet works fine on a localhost because the file you upload resides on the host machine (where FileServer.aspx is a new page invoked from the UploadFile call) function...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.