'test a file upload in postman

i am creating a method that should upload a file to an api.the method isn't uploading the file into the specific folder.and upon testing on postman i get a 200 ok status code but the file isn't uploaded on sending it at postman.on the postman

this is the method in the imagecontroller

 public function pushimage(Request $request)
 {          
  $file=$request->file('image');
  if($request->hasFile('image')){
    $extension = $file->getClientOriginalExtension();
    $newimage=rand() . '.' . $extension;
    $file->move(public_path() . ("/images/product/fileimage/"), $newimage);
    return response()->json($newimage);
}else{
    return response()->json('file not found');
}   

}

this is the api route

Route::post('/push_image','imagecontroller@pushimage');

upon uploading the file in the body section in postman it returns the response of "file not found". i havent understood what am doing it wrong to prevent the execution of the function.



Solution 1:[1]

i had forgotten to tick this button here correct answer in postman.also add the boundary and define it

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1