Android Question Not able to upload image file on a .Net server by Multipart method.

Juzer Hussain

Active Member
Licensed User
Longtime User
Hi Guys,
As I am trying to upload image file to a .Net server using Multipart functionality I am getting this error.
I tried PostBytes it was sending blank files. On the server side permissions are granted to folder.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>IIS 7.5 Detailed Error - 501.0 - ModSecurity Action</title>
<style type="text/css">
<!--
body{margin:0;font-size:.7em;font-family:Verdana,Arial,Helvetica,sans-serif;background:#CBE1EF;}
code{margin:0;color:#006600;font-size:1.1em;font-weight:bold;}
.config_source code{font-size:.8em;color:#000000;}
pre{margin:0;font-size:1.4em;word-wrap:break-word;}
ul,ol{margin:10px 0 10px 40px;}
ul.first,ol.first{margin-top:5px;}
fieldset{padding:0 15px 10px 15px;}
.summary-container fieldset{padding-bottom:5px;margin-top:4px;}......

My code is as below.
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/frmUploadFile.aspx", Null, files)
hc.Execute(req, 1)

Can someone pls guide me.
Thanks
Juzer
 

DonManfred

Expert
Licensed User
Longtime User
The same thread again?
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Please use code tags when posting code! It is NOT fun to read unformatted code (not using code tags) for anyone who want help

And please post the FULL return from the call. not using LOG() (it is crapped at 4000 bytes).
Write the result to a file to get the hole answer.
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Upvote 0
Top