Undefined index: file error in HOSTINGER shared hosting

V

vel murugan

Guest
I have below code for file upload . This is wotking in my localhost with IP address. But its not working in shared hoting that is Hostinger. Its showing below error. Please help.

Undefined index: file {"exception":"[object] (ErrorException(code: 0): Undefined index: file at /home/u766753775/domains/nammoor.online/public_html/laravel/routes/web.php:527)

IONIC 4:

async CameraImageUploadwithoutCrop() {
await this.imagePicker.getPictures({ maximumImagesCount: 1, outputType: 0 }).then((results) => {
for (const image of results) {
console.log('Image URI: ' + image);
const fileTransfer: FileTransferObject = this.transfer.create();
const uploadOpts: FileUploadOptions = {
fileKey: 'file',
fileName: image.substr(image.lastIndexOf('/') + 1)
};

fileTransfer.upload(image, 'https://nammoor.online/post/uploadImage', uploadOpts)
// fileTransfer.upload(image, 'http://192.168.43.210:8000/post/uploadImage', uploadOpts)
.then((data) => {
console.log(data);
this.respData = JSON.parse(data.response);
console.log(this.respData);
this.imageUrl = this.respData.fileUrl;
}, (err) => {
console.log(err);
});

}
}, (err) => { console.log(err); });
}

PHP:


[1]:



Continue reading...
 
Top