3
Answers

Upload file using WebClient

Dipika

Dipika

7y
234
1
Stream stream = file.InputStream;
file.SaveAs(physicalPath);
BinaryReader b = new BinaryReader(file.InputStream);
byte[] fileData = b.ReadBytes(file.ContentLength);
var wc = new WebClient();
wc.Headers.Add("Authorization", "Bearer "+ AccessToken);
byte[] response = wc.UploadData(url, "PUT", fileData);
string s = wc.Encoding.GetString(response);
var obj = JObject.Parse(s);
 
 
Above code is not working with Large Files
In web.config i have updated
<httpRuntime maxRequestLength="1048576" />
still not working 
Answers (3)