473,395 Members | 1,677 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.

UploadFile

Hi,

UploadFile() is always throwing WebException: "The remote
server returned an error: (405) Method Not Allowed."

Is there any setting that I miss? IIS setting?

Please help, thanks!
-CL
Nov 18 '05 #1
5 1976
Does your form tag look something like this?

<FORM id="Form1" method="post" encType="multipart/form-data" runat="server">
"Ching-Lung" <cl******@hotmail.com> wrote in message
news:02****************************@phx.gbl...
Hi,

UploadFile() is always throwing WebException: "The remote
server returned an error: (405) Method Not Allowed."

Is there any setting that I miss? IIS setting?

Please help, thanks!
-CL

Nov 18 '05 #2
<FORM id="Form1" method="post" runat="server">

-CL

-----Original Message-----
Does your form tag look something like this?

<FORM id="Form1" method="post" encType="multipart/form- data" runat="server">

"Ching-Lung" <cl******@hotmail.com> wrote in message
news:02****************************@phx.gbl...
Hi,

UploadFile() is always throwing WebException: "The remote server returned an error: (405) Method Not Allowed."

Is there any setting that I miss? IIS setting?

Please help, thanks!
-CL

.

Nov 18 '05 #3
you need to add this:

encType="multipart/form-data"

to the form tag.

Thanks,

Manit Chanthavong

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #4
Hi,

I've tried adding encType="multipart/form-data" it doesn't
throw the 405 web exception but my <input type=file>
doesn't work. For some reason, <input type=file> is
an "undefined" object.

Any idea?
-CL


-----Original Message-----
Does your form tag look something like this?

<FORM id="Form1" method="post" encType="multipart/form- data" runat="server">

"Ching-Lung" <cl******@hotmail.com> wrote in message
news:02****************************@phx.gbl...
Hi,

UploadFile() is always throwing WebException: "The remote server returned an error: (405) Method Not Allowed."

Is there any setting that I miss? IIS setting?

Please help, thanks!
-CL

.

Nov 18 '05 #5
"Ching-Lung" wrote:
Hi,

UploadFile() is always throwing WebException: "The remote
server returned an error: (405) Method Not Allowed."


I guess that is WebClient.UploadFile(). Well, if you don't specify the
HTTP verb, it will post the file. In that case, there must be some web
application handling the file upload -- which seems not to be case here.

For a "pure" (no web app) HTTP file upload, try HTTP PUT:

string url = "http://host/vdir/test.txt";
WebClient client = new WebClient();
byte[] response = client.UploadFile(url, "PUT", @"C:\temp\test.txt");

This requires write permissions on the virtual directory "vdir".

Cheers,

--
Joerg Jooss
jo*********@gmx.net
Nov 18 '05 #6

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 :-))...
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...
0
by: lgbjr | last post by:
Hi All, I thought this was going to be a simple task, but I just can't get this to work: I need to transfer a file from a client machine to a server using a windows app created with VB.Net...
2
by: UJ | last post by:
I'm trying to upload stuff using the UploadFile from WebClient and I've noticed that it adds header and footers to the stream. Is there any way to get rid of that automatically? I'm using...
0
by: Mihaly | last post by:
I have a WinForms 1.1 application and I want to post some files on the webserver, using WebClient.UploadFile() method. I try the solution from MSDN site -...
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
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.