diff --git a/htdocs/core/ajax/flowjs-server.php b/htdocs/core/ajax/flowjs-server.php
index e1f5feaaf10..d520c57c9c5 100644
--- a/htdocs/core/ajax/flowjs-server.php
+++ b/htdocs/core/ajax/flowjs-server.php
@@ -62,13 +62,19 @@ $flowTotalSize = GETPOST('flowTotalSize', 'alpha');
top_httphead();
dol_syslog(join(',', $_GET));
-$result = true;
+$result = false;
if (!empty($upload_dir)) {
$temp_dir = $upload_dir.'/'.$flowIdentifier;
} else {
$temp_dir = DOL_DATA_ROOT.'/'.$module.'/temp/'.$flowIdentifier;
- $upload_dir = $temp_dir;
+ $upload_dir = DOL_DATA_ROOT.'/'.$module.'/temp/';
+}
+
+if ($module != "test" && !isModEnabled($module)) {
+ echo json_encode("The module ".$module." is not enabled");
+ header("HTTP/1.0 400");
+ die();
}
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
@@ -83,6 +89,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
if (file_exists($upload_dir.'/'.$flowFilename)) {
echo json_encode('File '.$flowIdentifier.' was already uploaded');
header("HTTP/1.0 200 Ok");
+ die();
} elseif (!empty($_FILES)) foreach ($_FILES as $file) {
// check the error status
if ($file['error'] != 0) {
@@ -133,7 +140,7 @@ function createFileFromChunks($temp_dir, $upload_dir, $fileName, $chunkSize, $to
$total_files = 0;
$files = dol_dir_list($temp_dir, 'files');
foreach ($files as $file) {
- if (stripos($file, $fileName) !== false) {
+ if (stripos($file["name"], $fileName) !== false) {
$total_files++;
}
}
diff --git a/htdocs/public/test/test_forms.php b/htdocs/public/test/test_forms.php
index acc9151798f..b7ed524e297 100644
--- a/htdocs/public/test/test_forms.php
+++ b/htdocs/public/test/test_forms.php
@@ -105,6 +105,75 @@ $array = array(1=>'Value 1', 2=>'Value 2', 3=>'Value 3');
$arrayselected = array(1, 3);
print $form->multiselectarray('testmulti', $array, $arrayselected, '', 0, 'minwidth100');
+print '
'."\n";
+
+// Test6a: Upload of big files
+print "Test 6a: Upload of big files
\n";
+print "The file will be uploaded in the directory: documents/test/temp/
\n";
+
+if (is_file(DOL_DOCUMENT_ROOT.'/includes/flowjs/flow.js')) {
+ print '';
+ print ' No file selected.';
+ print '