选择5时,可将要立即上传的图像排队

时间:2019-05-29 14:00:50

标签: javascript php queue

我有一个程序可以实时上载图像,但是我想在内存中将图像排队,并在队列大小达到5张图像时批量转换它们,然后将图像上载到服务器。有关如何执行的任何线索或帮助。


$name = $_POST['name'];
//echo '<script>console.log({$name})</script>';
//echo $name;
$target_dir = "upload/";
$target_file = $target_dir . basename($_FILES["file"]["name"]);

// Select file type
$imageFileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION));

// Valid file extensions
$extensions_arr = array("jpg","jpeg","png","gif");

// Check extension
if( in_array($imageFileType,$extensions_arr) ){

    //Insert record
   $query = "insert into images(name,name2) values('".$name."','$unique')";
   mysqli_query($con,$query);

   // Upload file
   move_uploaded_file($_FILES['file']['tmp_name'],$target_dir.$name);

}

0 个答案:

没有答案