Can't upload image to server using FileTransfer

Hello Everyone :slight_smile:

I am trying to upload an image from my app to the server but it doesn’t work. It always returns:

{
    "code": 1,
    "http_status": 405, // Method Not Allowed
}

Here is my code:

TS File

    const fileTransfer: FileTransferObject = this.fileTransfer.create();

    let options1: FileUploadOptions = {
        fileKey: 'file',
        fileName: 'name.jpg',
        headers: {
            'Accept' : 'application/json',
            'Authorization' : 'Bearer ' + this.token
        }
    }
    
    fileTransfer.upload(imageData, apiUrl, options1)
    .then((data) => {
        this.loadingSrvc.hide();
        let alert = this.alertCtrl.create({
            message: JSON.stringify(data)
        });
        alert.present();
    }, (err) => {
        this.loadingSrvc.hide();
        let alert = this.alertCtrl.create({
            message: JSON.stringify(err)
        });
        alert.present();
    });

API URL

    public function profilePicture(Request $request)
    {
        if(Input::file('file')){
            $newFileName = 'investor-'.strtolower(Auth::user()->first_name).'-'.date('m-d-Y-H-i-s').'.'.Input::file('file')->extension();
            $newFilePath = public_path('assets/images/investor/profile/');
            
            Input::file('file')->move($newFilePath,$newFileName);
            
            Investor::where('investor_id', Auth::user()->investor_id)->update([
                'profile_image' => 'assets/images/investor/profile/'.$newFileName,
            ]);
            HistoryController::createHistory('fund_investment', Auth::user()->investor_id); 

            return response()->json('success');
        } else {
            return response()->json('error');
        }
    }

Ionic CLI Version: PRO 4.2.1
Cordova Verion: 8.0.0
NPM Version: 6.4.1
Node.js version: 8.11.3
Platform: Android


The weird thing is that the same code with a different API URL works on another function. I really don’t know what is the problem. I hope someone can help me with this. Thank you in advance :blush:

PLEASE HELP ME!!!

could you please help me :slight_smile:

No. Also don’t mention random people that were not involved in your topic. I removed all the unrelated names you mentioned.