[QUOTE]
Dim folder As String ="r:\temp\"
Dim maxsize As Long = 999999999999
Dim piclist As List = GetMultiparts(req ,folder,maxsize)
Log(piclist.Size)
For j=0 To piclist.size-1
Log(piclist.Get(j))
Next
[/QUOTE]
25328894
17
Part{n=,fn=null,ct=null,s=0,t=true,f=null}
Part{n=,fn=null,ct=null,s=0,t=true,f=null}
Part{n=,fn=null,ct=null,s=0,t=true,f=null}
Part{n=,fn=null,ct=null,s=0,t=true,f=null}
Part{n=,fn=null,ct=null,s=0,t=true,f=null}
Part{n=,fn=null,ct=null,s=0,t=true,f=null}
Part{n=,fn=null,ct=null,s=0,t=true,f=null}
Part{n=,fn=null,ct=null,s=0,t=true,f=null}
Part{n=,fn=null,ct=null,s=0,t=true,f=null}
Part{n=gallerypics,fn=null,ct=null,s=0,t=true,f=null}
Part{n=gallerypics,fn=pic4.jpg,ct=image/jpeg,s=4311388,t=true,f=r:\temp\MultiPart10749281659612284644}
Part{n=gallerypics,fn=pic5.jpg,ct=image/jpeg,s=4049843,t=true,f=r:\temp\MultiPart1733147283869530057}
Part{n=gallerypics,fn=pic8.jpg,ct=image/jpeg,s=3763956,t=true,f=r:\temp\MultiPart14608056935354210937}
Part{n=gallerypics,fn=pic9.jpg,ct=image/jpeg,s=4305587,t=true,f=r:\temp\MultiPart7925761567132071697}
Part{n=gallerypics,fn=pic10.jpg,ct=image/jpeg,s=3658261,t=true,f=r:\temp\MultiPart16777310328100045637}
Part{n=gallerypics,fn=5d1071f1-ae3d-473e-ab0e-009c4efdbc0d.jpg,ct=image/jpeg,s=582726,t=true,f=r:\temp\MultiPart6510141267914141141}
Part{n=gallerypics,fn=pic1.jpg,ct=image/jpeg,s=4655160,t=true,f=r:\temp\MultiPart12670979917436383701}
For j=0 To piclist.size-1
Dim current as JavaObject = piclist.Get(j)
Log(current.GetField(n))
Log(current.GetField(fn))
Log(current.GetField(ct))
Log(current.GetField(s))
Log(current.GetField(t))
Log(current.GetField(f))
Next
For Each p As Part In piclist
log(p.n)
log(p.fn)
...
Next
Thank you for that,1, For code just type [ code ] and [ /code ] without the spaces, around the code you want to show.
2, try (it looks like Part is defined as a type/class somewhere)
B4X:For j=0 To piclist.size-1 Dim current as JavaObject = piclist.Get(j) Log(current.GetField(n)) Log(current.GetField(fn)) Log(current.GetField(ct)) Log(current.GetField(s)) Log(current.GetField(t)) Log(current.GetField(f)) Next
if you know where Part is defined you could use
B4X:For Each p As Part In piclist log(p.n) log(p.fn) ... Next
**Not tested
25328894
17
Part{n=,fn=null,ct=null,s=0,t=true,f=null}
Error occurred on line: 27
java.lang.RuntimeException: Field: not found in: org.eclipse.jetty.util.MultiPartInputStreamParser$MultiPart
at anywheresoftware.b4j.object.JavaObject$FieldCache.getField(JavaObject.java:307)
at anywheresoftware.b4j.object.JavaObject.GetField(JavaObject.java:182)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:632)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:234)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:167)
at jdk.internal.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:108)
at anywheresoftware.b4a.shell.ShellBA.raiseEvent2(ShellBA.java:98)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:95)
at anywheresoftware.b4j.object.JServlet$Handle.run(JServlet.java:130)
at anywheresoftware.b4j.object.JServlet.Handle(JServlet.java:110)
at anywheresoftware.b4j.object.JServlet.doPost(JServlet.java:80)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:865)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1655)
at anywheresoftware.b4j.object.JServlet$Handle.run(JServlet.java:135)
at anywheresoftware.b4a.keywords.SimpleMessageLoop.runMessageLoop(SimpleMessageLoop.java:47)
at anywheresoftware.b4a.StandardBA.startMessageLoop(StandardBA.java:43)
at anywheresoftware.b4a.shell.ShellBA.startMessageLoop(ShellBA.java:119)
at anywheresoftware.b4a.keywords.Common.StartMessageLoop(Common.java:170)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:309)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:167)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:108)
at anywheresoftware.b4a.shell.ShellBA.raiseEvent2(ShellBA.java:98)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:95)
at b4j.example.main.main(main.java:29)
-1
0
ID received /portal/vendorlistingsadd/listing/f8bca21a-8198-4e76-908e-a6591294bd71
25328894
17
Part{n=,fn=null,ct=null,s=0,t=true,f=null}
Error occurred on line: 27
java.lang.RuntimeException: Field: n not found in: org.eclipse.jetty.util.MultiPartInputStreamParser$MultiPart
at anywheresoftware.b4j.object.JavaObject$FieldCache.getField(JavaObject.java:307)
at anywheresoftware.b4j.object.JavaObject.GetField(JavaObject.java:182)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:632)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:234)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:167)
at jdk.internal.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:108)
at anywheresoftware.b4a.shell.ShellBA.raiseEvent2(ShellBA.java:98)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:95)
at anywheresoftware.b4j.object.JServlet$Handle.run(JServlet.java:130)
at anywheresoftware.b4j.object.JServlet.Handle(JServlet.java:110)
at anywheresoftware.b4j.object.JServlet.doPost(JServlet.java:80)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:865)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1655)
at anywheresoftware.b4j.object.JServlet$Handle.run(JServlet.java:135)
at anywheresoftware.b4a.keywords.SimpleMessageLoop.runMessageLoop(SimpleMessageLoop.java:47)
at anywheresoftware.b4a.StandardBA.startMessageLoop(StandardBA.java:43)
at anywheresoftware.b4a.shell.ShellBA.startMessageLoop(ShellBA.java:119)
at anywheresoftware.b4a.keywords.Common.StartMessageLoop(Common.java:170)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:309)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:167)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:108)
at anywheresoftware.b4a.shell.ShellBA.raiseEvent2(ShellBA.java:98)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:95)
at b4j.example.main.main(main.java:29)
-1
0
Public Sub GetMultiparts(req As ServletRequest, folder As String, maxsize As Long) As List
Dim config As JavaObject
config.InitializeNewInstance("javax.servlet.MultipartConfigElement", Array(folder, maxsize, maxsize, 81920))
Dim f As JavaObject
f.InitializeNewInstance("java.io.File", Array(folder))
Dim parser As JavaObject
parser.InitializeNewInstance("org.eclipse.jetty.util.MultiPartInputStreamParser", Array(req.InputStream, req.ContentType, config, f))
Dim parts As JavaObject = parser.RunMethod("getParts", Null)
Dim result() As Object = parts.RunMethod("toArray", Null)
Return result
End Sub
Dim folder As String ="r:\temp\"
Dim maxsize As Long = 999999999999
Dim piclist As List = GetMultiparts(req ,folder,maxsize)
Log(piclist.Size)
For j=0 To piclist.size-1
Log(piclist.Get(j))
For Each q() As Object In piclist
Log(q(0)) ' first field 'n'
Log(q(1)) ' second field 'fn'
Log(q(5)) ' last field 'f'
Next
Next
ID received /portal/vendorlistingsadd/listing/f8bca21a-8198-4e76-908e-a6591294bd71
15947734
11
Part{n=,fn=null,ct=null,s=0,t=true,f=null}
Error occurred on line: 26 (clsUploadGallery)
java.lang.ClassCastException: class org.eclipse.jetty.util.MultiPartInputStreamParser$MultiPart cannot be cast to class [Ljava.lang.Object; (org.eclipse.jetty.util.MultiPartInputStreamParser$MultiPart is in unnamed module of loader 'app'; [Ljava.lang.Object; is in module java.base of loader 'bootstrap')
at b4j.example.clsuploadgallery._handle(clsuploadgallery.java:146)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:632)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:237)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:167)
at jdk.internal.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:108)
at anywheresoftware.b4a.shell.ShellBA.raiseEvent2(ShellBA.java:98)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:95)
at anywheresoftware.b4j.object.JServlet$Handle.run(JServlet.java:130)
at anywheresoftware.b4j.object.JServlet.Handle(JServlet.java:110)
at anywheresoftware.b4j.object.JServlet.doPost(JServlet.java:80)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:865)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1655)
at anywheresoftware.b4j.object.JServlet$Handle.run(JServlet.java:135)
at anywheresoftware.b4a.keywords.SimpleMessageLoop.runMessageLoop(SimpleMessageLoop.java:47)
at anywheresoftware.b4a.StandardBA.startMessageLoop(StandardBA.java:43)
at anywheresoftware.b4a.shell.ShellBA.startMessageLoop(ShellBA.java:119)
at anywheresoftware.b4a.keywords.Common.StartMessageLoop(Common.java:170)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:309)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:167)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:108)
at anywheresoftware.b4a.shell.ShellBA.raiseEvent2(ShellBA.java:98)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:95)
For j=0 To piclist.size-1
Log(piclist.Get(j))
For Each q() As Object In piclist
Log(q(0)) ' first field 'n'
Log(q(1)) ' second field 'fn'
Log(q(5)) ' last field 'f'
Next
Next
For Each q() As Object In piclist
Log(q(0)) ' first field 'n'
Log(q(1)) ' second field 'fn'
Log(q(5)) ' last field 'f'
Next
For Each q() As Object In piclist
if q(3) > 0 then ' s field
Log(q(0)) ' first field 'n'
Log(q(1)) ' second field 'fn'
Log(q(5)) ' last field 'f'
End if
Next
multipart/form-data; boundary=----WebKitFormBoundaryk5HYVcBtXBEdXkAY
252400
13
Error occurred on line: 38
java.lang.IllegalArgumentException: Argument is not an array
at java.base/java.lang.reflect.Array.get(Native Method)
at anywheresoftware.b4a.shell.ArraysUtils.getElement(ArraysUtils.java:76)
at anywheresoftware.b4a.shell.Shell.getArrayElement(Shell.java:482)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:269)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:167)
at jdk.internal.reflect.GeneratedMethodAccessor6.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:108)
at anywheresoftware.b4a.shell.ShellBA.raiseEvent2(ShellBA.java:98)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:95)
at anywheresoftware.b4j.object.JServlet$Handle.run(JServlet.java:130)
at anywheresoftware.b4j.object.JServlet.Handle(JServlet.java:110)
at anywheresoftware.b4j.object.JServlet.doPost(JServlet.java:80)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:865)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1655)
at anywheresoftware.b4j.object.JServlet$Handle.run(JServlet.java:135)
at anywheresoftware.b4a.keywords.SimpleMessageLoop.runMessageLoop(SimpleMessageLoop.java:47)
at anywheresoftware.b4a.StandardBA.startMessageLoop(StandardBA.java:43)
at anywheresoftware.b4a.shell.ShellBA.startMessageLoop(ShellBA.java:119)
at anywheresoftware.b4a.keywords.Common.StartMessageLoop(Common.java:170)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:309)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:167)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:108)
at anywheresoftware.b4a.shell.ShellBA.raiseEvent2(ShellBA.java:98)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:95)
at b4j.example.main.main(main.java:29)
-1
0
For Each q As Part In piclist
If File.Size("",q.TempFile) > 0 Then
Log(q.SubmittedFilename)
Log(q.TempFile)
End If
Next
multipart/form-data; boundary=----WebKitFormBoundary2QZ49DclFrAAFKcQ
252400
13
704337d3-526a-4f23-ad1a-e08a86010007.jpg
R:\temp\MultiPart11055134646866722083
f8bca21a-8198-4e76-908e-a6591294bd71.jpg
R:\temp\MultiPart1692671330704033114
3cdb1056-f0f1-4008-92c3-74079d9248bb.jpg
R:\temp\MultiPart10130409954491560717
56ac854f-b854-4bbf-a37c-f487cac28b9b.jpg
R:\temp\MultiPart9593845080616775779
55887bd3-ea6c-43bf-ab2a-245f2cfb88fb.jpg
R:\temp\MultiPart7977197111130885901
-1
0
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?