Senior Thesis: please help (uploading a file from HTTP server)

  • Thread starter Thread starter amin
  • Start date Start date
A

amin

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.

..
 
The file can be turned into a string and reconstituted on the other end. It
is quite common, for example, for SQL programmers to store small BLOBs in
nvarchar fields.

--
Gregory A. Beamer
MPV; MCP: +I, SE, SD, DBA

**********************************************************************
Think outside the box!
**********************************************************************
 
Back
Top