Hello,
I searched for a solution for multiupload in scriptcase using the file to server solution instead of BLOB in DB
I never find a clear solution on the forum and I had to search for myself.
So in case someone would need the solution here it is.
I’m using DropZone
In the “onapplicationInit”
echo '<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/dropzone/5.9.3/min/dropzone.min.css">'; echo '<script src="https://cdnjs.cloudflare.com/ajax/libs/dropzone/5.9.3/min/dropzone.min.js"></script>';
In the Onload
echo '< script>
Dropzone.options.myDropzone = {
url: “upload.php”,
maxFilesize: 5, // adapt in function of your needs
acceptedFiles: “image/*,application/pdf,.doc,.docx”, // adapt in function of your needs
addRemoveLinks: true
};
';
Create a label form
IN BOTH LABEL and TEXT insert the following code
< form action=“upload.php” class=“dropzone” id=“myDropzone”>
In the upload.php file
<?php $targetDir = "uploads/"; if (!file_exists($targetDir)) { mkdir($targetDir, 0777, true); } $targetFile = $targetDir . basename($_FILES["file"]["name"]); if (move_uploaded_file($_FILES["file"]["tmp_name"], $targetFile)) { echo "Upload réussi!"; } else { echo "Erreur d'upload."; } ?>
Adapt upon your needs
Be carefull the space between < and forst letter of the call that I added to be showed on the forum
Edit : It seems that the label file disapear after being used… working on a solution
Enjoy!