Bug? GetMultipartData map returns a pointer not a string

mrred128

Active Member
Licensed User
I am trying to get a general duty uploader and I am getting unexpected results.

The code is as follows.....

Sub Upload(req As ServletRequest, resp As ServletResponse)
If req.ContentType.Contains("multipart/form-data") Then
Dim m As Map = req.GetMultipartData("/c:/tester",2560000)
resp.ContentType = "text/html;charset=UTF-8"
Dim S As String = m.Get("datafile")
Log(S)
Else
resp.ContentType = "text/html;charset=UTF-8"
resp.Write("<html>")
resp.Write("<head>")
resp.Write("<title>File Upload Tool</title>")
resp.Write("</head>")
resp.Write("<body>")
resp.Write("<form enctype=""multipart/form-data"" method=""post"">")
resp.Write("<br><br><br><center><table border=0>")
resp.Write("<tr><td align=center><h2>File Upload Tool</h2></td></tr>")
resp.Write("<tr><td><input type=""file"" name=""datafile"" size=""40""></td></tr>")
resp.Write("<tr><td>&nbsp;</td></tr>")
resp.Write("<tr><td align=center><input type=""submit"" value=""Send""></td></tr>")
resp.Write("</table>")
resp.Write("<center>")
resp.Write("</form>")
resp.Write("</body>")
End If
End Sub


The web form as to browse a file. It uploads the file and the file is correctly decoded and put in the specified directory. However the string returned from the map is "org.eclipse.jetty.util.MultiPartInputStreamParser$MultiPart@5505aa49" which looks surprisingly like a pointer.

Any ideas?
 

mrred128

Active Member
Licensed User
Please use [code]code here...[/code] tags when posting code.

You used to have a graphic to do that. I had no clue how to do it otherwise. Thanks.

req.GetMultipartData: "Parses a multipart request and returns a Map with the parsed Parts as values and the parts names as keys."

B4X:
Dim p As Part = m.Get("datafile")
I assumed that "keys" where strings. I didn't find any reference to Part, but it was probably staring me in the face. Thanks.
 
Top