I'm trying to speed up the process of uploading file with Web Client I have wrote some code that works fine but very slow if I try to upload the same file directly from the website it would take a LOT less time any recommendation? or other libraries I should use?
static string CreateDownloadLink(string File)
{
string ReturnValue = string.Empty;
try
{
using (WebClient Client = new WebClient())
{
byte[] Response = Client.UploadFile("https://anonfile.com/api/upload", File);
string ResponseBody = Encoding.ASCII.GetString(Response);
if (ResponseBody.Contains("\"error\": {"))
{
ReturnValue += "There was a erorr while uploading the file.\r\n";
ReturnValue += "Error message: " + ResponseBody.Split('"')[7] + "\r\n";
}
else
{
ReturnValue += "Download link: " + ResponseBody.Split('"')[15] + "\r\n";
ReturnValue += "File name: " + ResponseBody.Split('"')[25] + "\r\n";
}
}
}
catch (Exception Exception)
{
ReturnValue += "Exception Message:\r\n" + Exception.Message + "\r\n";
}
return ReturnValue;
}