0

API Route

Route::post('user/profile', 'ApiUserController@updateProfile');

Dump in controller

dd($request->all());

Output: (working fine with POST method)

array:2 [
  "nick_name" => "steven"
  "avatar" => Illuminate\Http\UploadedFile {#1387
    -test: false
    -originalName: "P3-Info2.png"
    -mimeType: "image/png"
    -error: 0
    #hashName: null
    path: "/tmp"
    filename: "phpIID1sL"
    basename: "phpIID1sL"
    pathname: "/tmp/phpIID1sL"
    extension: ""
    realPath: "/tmp/phpIID1sL"
    aTime: 2021-03-14 16:50:42
    mTime: 2021-03-14 16:50:42
    cTime: 2021-03-14 16:50:42
    inode: 7874635
    size: 82806
    perms: 0100600
    owner: 33
    group: 33
    type: "file"
    writable: true
    readable: true
    executable: false
    file: true
    dir: false
    link: false
  }
]

If I change the request method to PUT, the output is empty as follows.

[]

May I know how to send the file with PUT method?

zarpio
  • 10,380
  • 8
  • 58
  • 71

0 Answers0