The file is actually loaded to a regular handler named FileHelper.
The limit is set on that handler with this line:
B4X:Dim data As Map = req.GetMultipartData(Main.TempDir, 100000)
Sub Doning1(filname As String)
PostPath = "http://www.XXXXX.com/websocket_with_fileupload/index.html"
Dim j As HttpJob
j.Initialize("", Me)
Dim mp As MultipartFileData
mp.Initialize
mp.Dir = rp.GetSafeDirDefaultExternal("")
mp.FileName = filname
mp.KeyName = "file"
mp.ContentType = "video/mp4"
j.PostMultipart(PostPath, Null, Array(mp))
Wait For (j) JobDone(j As HttpJob)
If j.Success Then
Log("- - - - - - - - - - - - - ")
If filname = j.GetString Then
ToastMessageShow("Film upladdad.", False)
Else
ToastMessageShow("Fel vid uppladdning", False)
End If
End If
j.Release
End Sub
What happens when it doesn't work?
Server and client logs.
Waiting for debugger to connect...
Program started.
08:06:05 -- C:\Projekt\B4J\SERVER~2\Objects\temp
2019-09-18 08:06:05.250:INFO::main: Logging initialized @830ms to org.eclipse.jetty.util.log.StdErrLog
2019-09-18 08:06:05.408:INFOejs.Server:main: jetty-9.4.z-SNAPSHOT; built: 2018-05-03T15:56:21.710Z; git: daa59876e6f384329b122929e70a80934569428c; jvm 1.8.0_191-b12
2019-09-18 08:06:05.460:INFOejs.session:main: DefaultSessionIdManager workerName=node0
2019-09-18 08:06:05.460:INFOejs.session:main: No SessionScavenger set, using defaults
2019-09-18 08:06:05.462:INFOejs.session:main: node0 Scavenging every 600000ms
2019-09-18 08:06:05.487:INFOejsh.ContextHandler:main: Started o.e.j.s.ServletContextHandler@c273d3{/,file:///C:/Projekt/B4J/ServerExampleNoMySQL/Objects/www/,AVAILABLE}
2019-09-18 08:06:05.491:INFOejs.AbstractNCSARequestLog:main: Opened C:\Projekt\B4J\ServerExampleNoMySQL\Objects\logs\b4j-2019_09_18.request.log
2019-09-18 08:06:05.551:INFOejs.AbstractConnector:main: Started ServerConnector@1970963{HTTP/1.1,[http/1.1]}{0.0.0.0:81}
2019-09-18 08:06:05.551:INFOejs.Server:main: Started @1133ms
Emulated network latency: 200ms
08:06:05 -- Server started
08:10:18 -- Main Load cam page
LEGACY
Start success: true
(Rect)(0, 0, 3264, 2448)
Start success: true
(Rect)(0, 0, 3264, 2448)
Videofile : 1.mp4
*** Service (httputils2service) Create ***
*** Service (httputils2service) Start **
ResponseError. Reason: java.net.SocketTimeoutException: timeout, Response:
java.net.SocketTimeoutException: timeout
08:06:05 -- Server started
08:57:51 -- [ws=anywheresoftware.b4j.object.WebSocket@b6cbcc, form1=anywheresoftware.b4j.object.WebSocket$JQueryElement@a7e666, result=anywheresoftware.b4j.object.WebSocket$JQueryElement@bbe345
, dateutils=null, main=null, bra_saker=null
, webutils=null, pushshared=null, chatshared=null
, dbutils=null]
08:57:54 -- 1.mp4
08:57:54 -- C:\Projekt\B4J\ServerExampleNoMySQL\Objects\temp\MultiPart7661210167037367669
Start success: true
(Rect)(0, 0, 3264, 2448)
Picture taken: (Bitmap): 1920 x 1080, scale = 1,00
Photo dir /storage/emulated/0/Android/data/nn.test/files
Doning 2.jpg
- - - - - - - - - - - - -
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Upload tool </title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="index.css" />
<script src="/b4j_ws.js"></script>
<script src="jquery.form.min.js"></script>
</head>
<body>
<h1>Upload tool </h1>
<form id="form1" action="filehelper" method="post" enctype="multipart/form-data">
<label for="file">Välj fil (max storlek 1Gb):</label>
<input type="file" name="file1">
<input type="submit" name="submit" value="Submit">
</form>
<p id="result"></p>
<script>
$( document ).ready(function() {
b4j_connect("/websocket_with_fileupload/ws");
});
</script>
~l6820119569:
</body>