Kristian Patangui
Kristian Patangui

Reputation: 23

Laravel Api Postman Upload Image Return Null

$files = $request->file('images'); // return {}

$_FILES['images']; // return {"name":"sample-passport.jpg","type":"image\/jpeg","tmp_name":"D:\\xampp\\tmp\\php4AD9.tmp","error":0,"size":264295}

Upvotes: 1

Views: 1849

Answers (2)

Dan
Dan

Reputation: 5358

Have you tried to remove the Content-Type header? According to this Github issue, it seems to be a problem.


So, I set up a new Laravel installation to test this out and it's working fine on my side. Of course, there's no authorisation whatsoever but this shouldn't impact the result too much.

routes/api.php

Route::post('/profile/upload_image', function (Request $request) {
    dd($request->file('image'));
});

Postman configs

postman config postman body

Upvotes: 1

user3422754
user3422754

Reputation: 1

Your post input attribute type change file after upload you will get a response.enter image description here

Upvotes: 0

Related Questions