Код: Выделить всё
function Products($data){
foreach($data as $row){
$product_id = $row['product_id'];
$file_name = $_FILES['file']['name'];
$file_size = $_FILES['file']['size'];
$file_tmp = $_FILES['file']['tmp_name'];
$file_type = $_FILES['file']['type'];
$file_ext = pathinfo($file_name, PATHINFO_EXTENSION);
$expensions= array("jpeg","jpg","png","JPEG","JPG","PNG");
$fileName = date('Ymdhis').".".$file_ext;
// Insert Sample Function
InsertFunction($fileName, $product_id);
}
}
$array = array(
array('product_id'=>1, 'file'=> /*$_FILES 1*/),
array('product_id'=>2, 'file'=> /*$_FILES 2*/),
);
echo json_encode(Products($array));
Подробнее здесь: https://stackoverflow.com/questions/782 ... de-foreach