Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Upload files to a folder in WSS

Reply
Thread Tools

Upload files to a folder in WSS

 
 
Kannan
Guest
Posts: n/a
 
      03-07-2004
Hello,
I was trying to upload a local file on a client machine to a
sharepoint folder using the WebClient object. This method is present
in a client side DLL. I need to upload the document using NTLM
authentication.

The method does not report any errors but the document does not appear
in the folder.

Here are the the two code snippets that I am working on and tested

Any help would be very appreciated.

Thanks
Kannan

/*********** Using UploadData ********************/
string uploadUrl = "http://sharepoint/sites/projectserver_102/Shared
Documents/Forms/AllItems.aspx";

//string uploadUrl = "http://sharepoint/sites/projectserver_102/Shared
Documents/";

string filePath = "C:\\Documents and Settings\\pv\\My
Documents\\test.txt";

FileInfo fiUploadFile = new FileInfo(filePath);
WebClient wcUploadAgent = new WebClient();
wcUploadAgent.Credentials = CredentialCache.DefaultCredentials;
FileStream fs = null;
fs = fiUploadFile.OpenRead();
Byte[] bUploadData = new Byte[fiUploadFile.Length];
fs.Read(bUploadData,0,bUploadData.Length);
string sResponse1 = System.Text.Encoding.ASCII.GetString(bUploadData);
Byte[] arrayBytes = wcUploadAgent.UploadData(uploadUrl,"POST",bUploadD ata);
string sResponse = System.Text.Encoding.ASCII.GetString(arrayBytes);


/***************** Using UploadFile ************************/
WebClient wcUploadAgent = new WebClient();
wcUploadAgent.Credentials = CredentialCache.DefaultCredentials;
Byte[] responseArray = wcUploadAgent.UploadFile(uploadUrl, "POST",
filePath);
string sResponse = System.Text.Encoding.ASCII.GetString(responseArray );
string returnValue = sResponse;
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ASP.NET 2.0, WSS 3.0: a ASP.NET App in Folder of WSS 3.0->Sec.Exep Sven W. ASP General 1 01-20-2008 02:17 PM
Could it be that after a WSS installation (wmsde) I got this scree =?Utf-8?B?c2hhaGFyYzc=?= MCSE 3 11-03-2005 10:26 PM
Is it possible to install WSS without sql installed on the server =?Utf-8?B?c2hhaGFyYzc=?= MCSE 2 11-03-2005 12:42 PM
wss upload.aspx cindy ASP .Net Web Services 0 06-09-2004 08:11 PM
Trying to create a web application for wss john ASP .Net 0 02-26-2004 03:46 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57