How to get the value of each img without going through input? And download it to server?

this is the resource I found
http://jsfiddle.net/qF7Ff/

what I"m doing now is to use js"s filereader to generate every base64 address
, each predicted to be an input name=icon []
, and then to download each video
, so it will be < input name= "icon []" type= "hidden" value= https://img.codeshelper.com/upload/img/2021/04/01/uwookwllll214688 >

.
foreach ($_POST["icon"] as $key => $value) {

      preg_match("/^(data:\s*image\/(\w+);base64,)/", $value, $result);
      $file_ext = ".".$result[2];
      $file_name = $first["prod_id"]."-".md5(rand());
      file_put_contents("../../images/product/".$file_name.$file_ext, base64_decode(str_replace($result[1], "", $value)));

the resource I found is always uploaded, except that every object it produces is
so how can I download these videos at the back of my server?
what changes does ajax need to do to respond?

ajax

var formData = new FormData($("-sharpform")[0]);

$.ajax({
        type: "POST",
        url: "xxx",
        data: formData,
        enctype: "multipart/form-data",
        cache: false,
        contentType: false,
        processData: false,
Apr.01,2021

your question is difficult to read and try to understand. Do you want to save the base 64 format images sent from the client < input type=hidden > to the server? The server implements

in this way.
foreach
    //
    if (preg_match('/^(data:\s*image\/(\w+);base64,)/', $value, $result)){
        $type = $result[2];
        $path = "upload/";
        if(!file_exists($path))
        {
            //
            mkdir($path, 0700);
        }
        $new_file = $path . time() . ".{$type}";
        if (file_put_contents($new_file, base64_decode(str_replace($result[1], '', $base64_image_content)))){
            echo ':', $new_file;
        } else {
            echo '';
        }
    }
Menu