This method uploads data in a byte array to a file on the remote server specified by the URI
[Visual Basic] Public Function
HttpUploadByteArrayToFile(ByVal remoteAddress As String, ByVal data
As Byte()) As Boolean
[C#] public bool
HttpUploadByteArrayToFile(string remoteAddress, byte[] data);
Parameters
remoteAddress
Upload URI
data
Data in byte array
Return Value
Returns True if successful, otherwise returns False
Explanation
The HttpUploadByteArrayToFile 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 Ret As Boolean
'Username and password
ImageKit1.File.HttpCredentials = New NetworkCredential("user", "password")
'When using "POST"
ImageKit1.File.HttpMethod = "POST"
ImageKit1.File.HttpHeaders.Set("Content-Disposition", "form-data; name=""file""; filename=""test.jpg""")
Ret = ImageKit1.File.HttpUploadByteArrayToFile("http://www.newtone.co.jp/test/upload.php", data)
'When using "PUT"
'ImageKit1.File.HttpMethod = "PUT"
'Ret = ImageKit1.File.HttpUploadByteArrayToFile("http://www.newtone.co.jp/test/test.jpg", data)
[Visual C#.NET]
bool Ret;
//Username and password
ImageKit1.File.HttpCredentials = new NetworkCredential("user", "password");
//When using "POST"
ImageKit1.File.HttpMethod = "POST";
ImageKit1.File.HttpHeaders.Set("Content-Disposition", "form-data; name=\"file\"; filename=\"test.jpg\"");
Ret = ImageKit1.File.HttpUploadByteArrayToFile("http://www.newtone.co.jp/test/upload.php", data);
//When using "PUT"
//ImageKit1.File.HttpMethod = "PUT";
//Ret = ImageKit1.File.HttpUploadByteArrayToFile("http://www.newtone.co.jp/test/test.jpg", data);
Dim Ret As Boolean
'Username and password
ImageKit1.File.HttpCredentials = New NetworkCredential("user", "password")
'When using "POST"
ImageKit1.File.HttpMethod = "POST"
ImageKit1.File.HttpHeaders.Set("Content-Disposition", "form-data; name=""file""; filename=""test.jpg""")
Ret = ImageKit1.File.HttpUploadByteArrayToFile("http://www.newtone.co.jp/test/upload.php", data)
'When using "PUT"
'ImageKit1.File.HttpMethod = "PUT"
'Ret = ImageKit1.File.HttpUploadByteArrayToFile("http://www.newtone.co.jp/test/test.jpg", data)
[Visual C#.NET]
bool Ret;
//Username and password
ImageKit1.File.HttpCredentials = new NetworkCredential("user", "password");
//When using "POST"
ImageKit1.File.HttpMethod = "POST";
ImageKit1.File.HttpHeaders.Set("Content-Disposition", "form-data; name=\"file\"; filename=\"test.jpg\"");
Ret = ImageKit1.File.HttpUploadByteArrayToFile("http://www.newtone.co.jp/test/upload.php", data);
//When using "PUT"
//ImageKit1.File.HttpMethod = "PUT";
//Ret = ImageKit1.File.HttpUploadByteArrayToFile("http://www.newtone.co.jp/test/test.jpg", data);
See Also
ImageKit.File Members | Newtone.ImageKit.Wpf.ImageKit