webdav portal upload func added
This commit is contained in:
parent
1da7c6c3b3
commit
a882072b02
23 changed files with 553 additions and 17 deletions
|
@ -110,6 +110,23 @@ namespace WebsitePanel.WebDav.Core
|
|||
webClient.UploadFile(Href, "PUT", filename);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Uploads content of a file specified by filename to the server
|
||||
/// </summary>
|
||||
/// <param name="data">Posted file data to be uploaded</param>
|
||||
public void Upload(byte[] data)
|
||||
{
|
||||
var credentials = (NetworkCredential)_credentials;
|
||||
string auth = "Basic " +
|
||||
Convert.ToBase64String(
|
||||
Encoding.Default.GetBytes(credentials.UserName + ":" + credentials.Password));
|
||||
var webClient = new WebClient();
|
||||
webClient.Credentials = credentials;
|
||||
webClient.Headers.Add("Authorization", auth);
|
||||
|
||||
webClient.UploadData(Href, "PUT", data);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Loads content of the resource from WebDAV server.
|
||||
/// </summary>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue