Is it possible to upload files contained in an array


New member
I use Ubuntu 20.04.

I have thousands of old photo images located on CD's and external hard drives. I want to organize and re-size these.
I choose image files from a source directory via SelectBox. I use AJAX to send the selected images to a PHP program upload3.php which, hopefully, will be able to upload the files to another target directory. I get the { data } sent to upload3.php and I am stuck. I can't copy the files to the target directory. How do I upload these files?? Using a form to upload the files one by one is out of the question!! Thanks in advance for help. R
<script type="text/javascript" >

    var myselected= $('#images').val();

const ajaxArr=Object.values(myselected);

for (var i=0; i<ajaxArr.length; i++) {

  type: "POST",
  url: "upload3.php",
  data: { ajaxArr }

}) // ready

Well, there are some issues with your code:
Please try this code once, maybe you can find the solution.

<script type="text/javascript">
$(document).ready(function() {
$("form").submit(function(event) {
event.preventDefault(); // Prevent the default form submission

var myselected = $('#images').val();
const ajaxArr = Object.values(myselected);

for (var i = 0; i < ajaxArr.length; i++) {
document.writeln(ajaxArr + "<br>");

type: "POST",
url: "upload3.php",
data: { ajaxData: ajaxArr }, // Wrap the array in an object with a key 'ajaxData'
success: function(response) {
// Handle the AJAX response here
error: function(error) {
// Handle the AJAX error here