Article View: alt.pl.comp.lang.csharp
Article #32Senior Thesis: please help (uploading a file from HTTP server)
From: amine
Date: Fri, 05 Sep 2003 04:00
Date: Fri, 05 Sep 2003 04:00
36 lines
2137 bytes
2137 bytes
Hi all,
I have been developing an application for an IPAQ.
I am trying to write some code that will allow the user to
upload files to an HTTP server. I of course can't use the
webclient class since it is not supported by the compact
framework.
is there anyway I can use the webrequest and webresponse
classes to upload files from the httpserver.
I got this snippet of code from a site but it doenst work:
HttpWebRequest req = (HttpWebRequest)WebRequest.Create
(url);
req.Method = "put";
String temp_file_content ="file content";
byte[] encoded_content = Encoding.UTF8.GetBytes
(temp_file_content);
req.ContentLength = encoded_content.Length;
Stream request_stream = req.GetRequestStream();
request_stream.Write (encoded_content, 0 ,
encoded_content.Length);
request_stream.Close();
HttpWebResponse resp = (HttpWebResponse) req.GetResponse();
resp.Close();
I also want to actually upload files not only strings. Is
there anyways I can do that without using the webclient
class
PLEASE any help is very appreciated since I have looked
all over and couldnt find anything. I am very desperate
Thank You.
Technical Details
Message-ID:
<3f580a5d$1@news.ucsc.edu>Path:
mbox-mo1.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!newsfeeds.sol.net!news.maxwell.syr.edu!in.100proofnews.com!in.100proofnews.com!cyclone.bc.net!news-hog.berkeley.edu!ucberkeley!128.114.129.38.MISMATCH!news.ucsc.edu!dhcp-55-208.cse.ucsc.eduShow Full Headers
Complete Article Headers
From: "amine" <am...@cats.ucsc.edu> Newsgroups: alt.pl.comp.lang.csharp Subject: Senior Thesis: please help (uploading a file from HTTP server) Date: Thu, 4 Sep 2003 21:00:32 -0700 Lines: 38 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 NNTP-Posting-Host: dhcp-55-208.cse.ucsc.edu Message-ID: <3f580a5d$1@news.ucsc.edu> X-Trace: 4 Sep 2003 21:00:29 -0800, dhcp-55-208.cse.ucsc.edu Organization: University of California, Santa Cruz Path: mbox-mo1.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!newsfeeds.sol.net!news.maxwell.syr.edu!in.100proofnews.com!in.100proofnews.com!cyclone.bc.net!news-hog.berkeley.edu!ucberkeley!128.114.129.38.MISMATCH!news.ucsc.edu!dhcp-55-208.cse.ucsc.edu MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit