469,626 Members | 1,466 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,626 developers. It's quick & easy.

Send file to server by HTTP-Post method

Hi ALL.

I would like to download file from some web-server that requires
Basic-Authetication, change somthing in the file and upload it back to the
server.
I can download the file and proceed as I need, but how should I upload it
back? Server provides standard HTML GUI for Browsers where client can fill
appropriate input field of the form with a full name of the local file. The
form uses POST method to upload file and has attribute

enctype="multipart/form-data"

What the simplest way to upload file programmatically? Is it possible to
control the uploading process if any?

Thanx
Evgeny
Nov 16 '05 #1
4 14584
Save posted file:
C#
((HttpPostedFile)HttpContext.Current.Request.Files[<filename>]).SaveAs(
<savetolocation> ) ;
"Evgeny Zoldin" <zo****@hotmail.com> wrote in message
news:ec****************@TK2MSFTNGP09.phx.gbl...
Hi ALL.

I would like to download file from some web-server that requires
Basic-Authetication, change somthing in the file and upload it back to the
server.
I can download the file and proceed as I need, but how should I upload it
back? Server provides standard HTML GUI for Browsers where client can fill
appropriate input field of the form with a full name of the local file. The form uses POST method to upload file and has attribute

enctype="multipart/form-data"

What the simplest way to upload file programmatically? Is it possible to
control the uploading process if any?

Thanx
Evgeny

Nov 16 '05 #2
I have an article with some tips on using WebClient and WebRequest to
post data, though it doesn't deal with file upload specifically:
http://odetocode.com/Articles/162.aspx

The article references a tool "Fiddler", which is an Http Debugging
Proxy and a great way to see "how your browser does it".

HTH,

--
Scott
http://www.OdeToCode.com

On Sun, 11 Jul 2004 23:29:50 +0200, "Evgeny Zoldin"
<zo****@hotmail.com> wrote:
Hi ALL.

I would like to download file from some web-server that requires
Basic-Authetication, change somthing in the file and upload it back to the
server.
I can download the file and proceed as I need, but how should I upload it
back? Server provides standard HTML GUI for Browsers where client can fill
appropriate input field of the form with a full name of the local file. The
form uses POST method to upload file and has attribute

enctype="multipart/form-data"

What the simplest way to upload file programmatically? Is it possible to
control the uploading process if any?

Thanx
Evgeny


Nov 16 '05 #3
I think you're asking whether you can automatically upload a file, without
the user interaction. The short answer is no, you can't. It would be a huge
security hole into the system. You will have to install an ActiveX control
(and be careful, .Net user controls will not help you here as they are
hosted in a secure environment) that would read the file and upload it. But
then again, unless you do it really well (as in only upload to a known host
name, over SSL) you will open a security hole into whoever installs the
control.

Jerry

"Evgeny Zoldin" <zo****@hotmail.com> wrote in message
news:ec****************@TK2MSFTNGP09.phx.gbl...
Hi ALL.

I would like to download file from some web-server that requires
Basic-Authetication, change somthing in the file and upload it back to the
server.
I can download the file and proceed as I need, but how should I upload it
back? Server provides standard HTML GUI for Browsers where client can fill
appropriate input field of the form with a full name of the local file.
The
form uses POST method to upload file and has attribute

enctype="multipart/form-data"

What the simplest way to upload file programmatically? Is it possible to
control the uploading process if any?

Thanx
Evgeny

Nov 16 '05 #4
Evgeny Zoldin wrote:
Hi ALL.

I would like to download file from some web-server that requires
Basic-Authetication, change somthing in the file and upload it back
to the server.
I can download the file and proceed as I need, but how should I
upload it back? Server provides standard HTML GUI for Browsers where
client can fill appropriate input field of the form with a full name
of the local file. The form uses POST method to upload file and has
attribute

enctype="multipart/form-data"

What the simplest way to upload file programmatically? Is it possible
to control the uploading process if any?


There's no "simple way" -- what you want is a proper implementation of
http://www.faqs.org/rfcs/rfc2388.html, based on
HttpWebRequest/HttpWebResponse. WebClient.UploadFile() should have been
that, but has a bug that may cause some server-side upload facilities (like
PHP) to fail.

Cheers,

--
Joerg Jooss
jo*********@gmx.net

Nov 16 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Salim Afar | last post: by
reply views Thread by zhimin | last post: by
4 posts views Thread by ad | last post: by
1 post views Thread by michi | last post: by
5 posts views Thread by Andreas | last post: by
1 post views Thread by Henk | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.