Hi DonManfred,
Thanks for replying.
Below is the code i tried to use.
I changed the path to my server.
I guess content type needs to be chaged ??
Dim fd As FileData
If firsttime Then
hc.Initialize("hc")
End If
'Activity.LoadLayout("main")
'Add files
Dim files As List
files.Initialize
Dim fd As FileData
fd.Initialize
fd.Dir = File.DirAssets
fd.FileName = "star.png"
fd.KeyName = "Aufnahme"
fd.ContentType = "application/octet-stream"
files.Add(fd)
'Add second file
Dim fd As FileData
fd.Initialize
fd.Dir = File.DirAssets
fd.FileName = "glue.png"
fd.KeyName = "coca_cola"
fd.ContentType = "application/octet-stream"
files.Add(fd)
'Add name / values pairs (parameters)
Dim NV As Map
NV.Initialize
NV.Put("note1", "abc")
NV.Put("note2", "def")
NV.Put("action", "upload")
Dim req As OkHttpRequest
req = MultiPartPost.CreatePostRequest("
http://www.myserver.com/UploadFile.aspx", NV, files)
hc.Execute(req, 1)
Server Side :
protected void Page_Load(object sender, EventArgs e)
{
{
HttpFileCollection uploadFiles = Request.Files;
string summary = "<p>Files Uploaded:</p><ol>";
int i;
for (i = 0; i < uploadFiles.Count; i++)
{
HttpPostedFile postedFile = uploadFiles
;
System.IO.Stream inStream = postedFile.InputStream;
byte[] fileData = new byte[postedFile.ContentLength];
inStream.Read(fileData, 0, postedFile.ContentLength);
postedFile.SaveAs(Server.MapPath("App\\Images") + "\\" + postedFile.FileName);
}
}
I dont get any error and file also is not uploading.
Juzer