473,326 Members | 2,111 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,326 software developers and data experts.

Uploading files using WebClient

I am trying to run the following C# code:
----------------------------------------
String uriString = "http://10.1.1.100/images/";
WebClient myWebClient = new WebClient();
string fileName = "C:\\agoodfriend.jpg";
byte[] responseArray = myWebClient.UploadFile
(uriString,"POST",fileName);
----------------------------------------

But I get the following error:

Exception Details: System.Net.WebException: The remote
server returned an error: (405) Method Not Allowed.

Does anyone know why this happens?

I suspected it was a permission thing. I tried enabling
the directory to be written, but it didn't work.

Thanks in advance for the help
Nov 18 '05 #1
3 2376
the uriString you supply has to support file uploads. the one you supplied
did not.

did you write a page to receive the file, or install some file upload
support software on you web server?

-- bruce (sqlwork.com)
"Mariela" <an*******@discussions.microsoft.com> wrote in message
news:04****************************@phx.gbl...
I am trying to run the following C# code:
----------------------------------------
String uriString = "http://10.1.1.100/images/";
WebClient myWebClient = new WebClient();
string fileName = "C:\\agoodfriend.jpg";
byte[] responseArray = myWebClient.UploadFile
(uriString,"POST",fileName);
----------------------------------------

But I get the following error:

Exception Details: System.Net.WebException: The remote
server returned an error: (405) Method Not Allowed.

Does anyone know why this happens?

I suspected it was a permission thing. I tried enabling
the directory to be written, but it didn't work.

Thanks in advance for the help

Nov 18 '05 #2
Are you attempting to upload files using the multipart/form-data encoding?
If so

1. Your client needs to send data using this protocol and format
2. The server needs to have something that supports this as well.

--
Shiv R. Kumar
http://www.matlus.com
Nov 18 '05 #3
Are you attempting to upload files using the multipart/form-data encoding?
If so

1. Your client needs to send data using this protocol and format
2. The server needs to have something that supports this as well.

--
Shiv R. Kumar
http://www.matlus.com
Nov 18 '05 #4

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

Similar topics

4
by: brianinbox | last post by:
Hi, I've been trying to upload file using webclient.uploadfile method from my IIS webserver to an Apache webserver without any success. On the Apache server (server that receives the incoming...
0
by: ron | last post by:
is there a way to upload files with the webclient component ?? mywebclient.uploadfile ... simple uploads a file, but I can´t specify any form field like INPUT TYPE=FILE SIZE=40 NAME="FILE1...
2
by: genc ymeri | last post by:
I'm uploading a text through http server but I keep getting the below error. Is the below error coming from my code or from the http server ???? Any help/tip will be very much appreciated. Thank...
6
by: genc ymeri | last post by:
Hi, We are struggeling to upload a file through a C# webClient into JBoss web server. Meanwhile we are able to upload a file from the webserver itself. The problem is only with C# webClient . The...
4
by: marfi95 | last post by:
Hi all, I'm trying to do what I consider to be a fairly simple task, yet I'm having a heck of a time getting it to work. I'm trying to upload a file (without user intervention and a browser)...
0
by: Giulio Simeone | last post by:
Browsing in the web I find a lot of articles that argue: "With ASP.NET 2.0. uploading files is pretty easy!". I spent on that problem last three days but didn't found my way through it. I have...
1
by: neoret | last post by:
Hi there. I need to perform an upload of a document using HTTP post. This has to be done from my windows form using C#. My challenge is: 1: To send - the word document 2: To attach several...
8
by: ThunderMusic | last post by:
Hi, I'm currently building a little web site for me and my friends where we would like to be able to post big files (10Mb to 250Mb approx.) Right now the ASP.Net UploadFile control can't do it as...
0
by: mivey4 | last post by:
I have been experimenting with sending and receiving files using the webClient class provided in .NET. (C#) I don't seem to have any problems downloading files from my test web server using the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.