0

I create api to upload image, it work on postman, but response not found on Android using Multipart data.

this is my snippet

if ($request->hasFile('attachment')) {
            $file = $request->file('attachment');
            $filename = $file->getClientOriginalName();
            $attachmentName = 'bookingfee_' . $bookingData->salesforce_id . '_' . md5($filename) . '.' . $file->getClientOriginalExtension();
            $file->move('attachment/', $attachmentName);

            $bf = BookingFee::find($bookingfee_id);
            $bf->attachment = $attachmentName;
            $bf->save();
        } else {
            $this->result['message'] = 'File not found';
            return $this->result;
        }

have any clue for this? should i add something to my controller? on my partner code, always return File not Found. i use POST Method

1 Answers1

0

you should remove header (content-type: multipart/form-data) if you using it.

enter image description here

I faced a problem like this once and i found this link

Ahmad Elkenany
  • 575
  • 5
  • 23