I’ve been working on multiple file uploads on mobile using ionic v1 and Laravel for my REST APIs… these codes work perfectly on a local server, but when I upload the API codes on a live shared hosting site. the API is throwing an error:
I am calling the API for every image in a foreach loop. here’s my code
app.factory('sendService', function ($http, $q, imageUploadService, $timeout, apiUrl) {
return {
cargoPhotos: function(id, data){
let d = $q.defer();
var api = apiUrl + "/api/sendcargophotos";
let q = [];
angular.forEach(data, function(value, key){
let origName = value;
var options = {
filename: key + '.jpg',
params : {
report_no : id,
label: key
},
chunkedMode: false,
headers : {
Connection : "close"
}
};
$timeout(q.push(imageUploadService.upload(api, origName, options)),1000);
});
$q.all(q).then(res=>{
d.resolve(res);
}, err=>{
d.reject(err);
})
return d.promise;
},
}
});