diff --git a/RestAPI.cs b/RestAPI.cs index c9e94d3..285abad 100644 --- a/RestAPI.cs +++ b/RestAPI.cs @@ -241,7 +241,12 @@ public virtual async Task SendHttpClientRequest(string endpoint, Requ httpWebRequest.ContentType = "application/x-www-form-urlencoded"; Stream dataStream = await httpWebRequest.GetRequestStreamAsync().ConfigureAwait(false); - FileStream fileStream = new FileStream(parms["path"], FileMode.Open, FileAccess.Read); + + // If the given path is a physical path, open file. If not, read from URL. + var fileStream = parms["source"] == "local" ? + new FileStream(parms["path"], FileMode.Open, FileAccess.Read) : + (new WebClient()).OpenRead(parms["path"]); + byte[] buffer = new byte[4096]; int bytesRead = 0;