This method uploads data in a byte array to a file on the remote server specified by the URI
[Visual Basic] Public Function
UploadByteArrayToFile(ByVal remoteAddress As String, ByVal data As
Byte()) As Boolean
[C#] public bool UploadByteArrayToFile(string
remoteAddress, byte[] data);
Parameters
remoteAddress
Upload URI
data
Data in byte array
Return Value
Returns True if successful, otherwise returns False
Explanation
The UploadByteArrayToFile method uploads data in a byte array to a file on the remote server specified by the URI
This method is enabled for HTTP or HTTPS protocol.
Example
[Visual Basic.NET]
Dim _http As New Newtone.ImageKit.WPF.Http
Dim Ret As Boolean
'Username and password
_http.Credentials = New NetworkCredential("user", "password")
'When using "POST"
_http.Method = "POST"
_http.Headers.Set("Content-Disposition", "form-data; name=""file""; filename=""test.jpg""")
Ret = _http.UploadByteArrayToFile(New Uri("http://www.newtone.co.jp/test/upload.php"), data)
'When using "PUT"
'_http.Method = "PUT"
'Ret = _http.UploadByteArrayToFile(New Uri("http://www.newtone.co.jp/test/test.jpg"), data)
[Visual C#.NET]
Newtone.ImageKit.WPF.Http _http = new Newtone.ImageKit.WPF.Http();
bool Ret;
//Username and password
_http.Credentials = new NetworkCredential("user", "password");
//When using "POST"
_http.Method = "POST";
_http.Headers.Set("Content-Disposition", "form-data; name=\"file\"; filename=\"test.jpg\"");
Ret = _http.UploadByteArrayToFile(new Uri("http://www.newtone.co.jp/test/upload.php"), data);
//When using "PUT"
//_http.Method = "PUT";
//Ret = _http.UploadByteArrayToFile(new Uri("http://www.newtone.co.jp/test/test.jpg"), data);
Dim _http As New Newtone.ImageKit.WPF.Http
Dim Ret As Boolean
'Username and password
_http.Credentials = New NetworkCredential("user", "password")
'When using "POST"
_http.Method = "POST"
_http.Headers.Set("Content-Disposition", "form-data; name=""file""; filename=""test.jpg""")
Ret = _http.UploadByteArrayToFile(New Uri("http://www.newtone.co.jp/test/upload.php"), data)
'When using "PUT"
'_http.Method = "PUT"
'Ret = _http.UploadByteArrayToFile(New Uri("http://www.newtone.co.jp/test/test.jpg"), data)
[Visual C#.NET]
Newtone.ImageKit.WPF.Http _http = new Newtone.ImageKit.WPF.Http();
bool Ret;
//Username and password
_http.Credentials = new NetworkCredential("user", "password");
//When using "POST"
_http.Method = "POST";
_http.Headers.Set("Content-Disposition", "form-data; name=\"file\"; filename=\"test.jpg\"");
Ret = _http.UploadByteArrayToFile(new Uri("http://www.newtone.co.jp/test/upload.php"), data);
//When using "PUT"
//_http.Method = "PUT";
//Ret = _http.UploadByteArrayToFile(new Uri("http://www.newtone.co.jp/test/test.jpg"), data);
See Also