I have this input field where I can upload multiple pictures. I want to send these images to my php side where I upload these pictures to my pictures directory. It does work but for some reason on bigger pictures the information I need on my php side isn't send over to my php side and I don't understand why. Any help would be appreciated. This is my code. When I echo tmp_name and name for a bigger file I only get the name as result but for a smaller file I get the tmp_name and the name of the file for instance big file. Why don't I get the temp filename/location for the bigger files and how can I remedy this?
upload1small
echo $fileName1['tmp_name'];
echo $fileName1['name'];
result C:\Windows\Temp\phpE7CF.tmp potd-husky_3235255k.jpg
upload2big
echo $fileName1['tmp_name'];
echo $fileName1['name'];
result lion.jpg
<input id=\"file-input\" type=\"file\" multiple>
<div id=\"preview\"></div>
<div> <button class='btn btn-default btn-sm toevoegen' onclick='uploadpic(".$deal_id.");'> toevoegen </button> <button class='btn btn-default btn-sm' onclick='hidephotoupload();'> Annuleren </button>
function uploadpic(id){
var data = []
var data = new FormData();
jQuery.each(jQuery('#file-input')[0].files, function (i, file) {
data.append('file-' + i, file);
});
$.ajax({
url: 'dealimage.php?id='+id,
cache: false,
contentType: false,
processData: false,
type: 'POST',
data: data
});
setTimeout( function(){
$('#test').load('loaddeal.php?l=LoadDeal&dealid='+id);
} , 200 );
}
Then on the php side I have this:-
if(isset($_FILES['file-0']['name'])){
$fileName[] = $_FILES['file-0'];
}
if(isset($_FILES['file-1']['name'])){
$fileName[] = $_FILES['file-1'];
}
if(isset($_FILES['file-2']['name'])){
$fileName[] = $_FILES['file-2'];
}
if(isset($_FILES['file-3']['name'])){
$fileName[] = $_FILES['file-3'];
}
if(isset($_FILES['file-4']['name'])){
$fileName[] = $_FILES['file-4'];
}
if(isset($_FILES['file-5']['name'])){
$fileName[] = $_FILES['file-5'];
}
if(isset($_FILES['file-6']['name'])){
$fileName[] = $_FILES['file-6'];
}
if(isset($_FILES['file-7']['name'])){
$fileName[] = $_FILES['file-7'];
}
foreach($fileName as $fileName1){
echo $fileName1['tmp_name'];
echo $fileName1['name'];
}