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 System.Uri, ByVal data As Byte()) As Boolean
[C#] public bool UploadByteArrayToFile(System.Uri 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.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.Http _http = new Newtone.ImageKit.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

Http Class | Http Members

 

The ImageKit.NET X is created by Newtone Corporation