public override UploadResult Upload(Stream stream, string fileName) { if (Uploader == null || string.IsNullOrEmpty(Uploader.UploadURL)) { Errors.Add(Resources.Pomf_Upload_Please_select_one_of_the_Pomf_uploaders_from__Destination_settings_window____Pomf_tab__); return(null); } UploadResult result = UploadData(stream, Uploader.UploadURL, fileName, "files[]"); if (result.IsSuccess) { PomfResponse response = JsonConvert.DeserializeObject <PomfResponse>(result.Response); if (response.success && response.files != null && response.files.Count > 0) { string url = response.files[0].url; if (!URLHelpers.HasPrefix(url) && !string.IsNullOrEmpty(Uploader.ResultURL)) { url = URLHelpers.CombineURL(Uploader.ResultURL, url); } result.URL = url; } } return(result); }
private string GetObjectURL(string objectName) { objectName = objectName.Trim('/'); objectName = Helpers.URLPathEncode(objectName); string url = string.Empty; if (S3Settings.UseCustomCNAME) { if (!string.IsNullOrEmpty(S3Settings.CustomDomain)) { url = Helpers.CombineURL(S3Settings.CustomDomain, objectName); } else { url = Helpers.CombineURL(S3Settings.Bucket, objectName); } } else { url = Helpers.CombineURL(GetEndpoint(), objectName); } if (!URLHelpers.HasPrefix(url)) { url = "http://" + url; } return(url); }
public override UploadResult Upload(Stream stream, string fileName) { UploadResult result = SendRequestFile(Uploader.UploadURL, stream, fileName, "files[]"); if (result.IsSuccess) { PomfResponse response = JsonConvert.DeserializeObject <PomfResponse>(result.Response); if (response.success && response.files != null && response.files.Count > 0) { string url = response.files[0].url; if (!URLHelpers.HasPrefix(url) && !string.IsNullOrEmpty(Uploader.ResultURL)) { url = URLHelpers.CombineURL(Uploader.ResultURL, url); } result.URL = url; } } return(result); }