0

I am trying to POST a file along with other form data to my laravel API, I have the exact same code as https://stackoverflow.com/a/25264008

But my Laravel API is not receiving any file at all. However, when I test my API with Postman, it works perfectly.

EDIT (this is the partial code in my laravel API):

$file = $request->file('coverphoto');
$extension = $file->getClientOriginalExtension();
$fileName = bin2hex(openssl_random_pseudo_bytes(8)).'.'.$extension;
$file->move('uploads', $fileName);
$myobj->cover = $fileName;
...
$myobj->save();
5
  • What happens if you check in your Networks tab in console ? Commented Jan 13, 2016 at 18:38
  • I get status 200 from my API, like usual... Commented Jan 14, 2016 at 7:38
  • Not sure if this information is useful to you - when the file is selected, I get this in Network: data:image/jpeg;base64,/9j/4QKzRXhp... Commented Jan 14, 2016 at 7:44
  • How about response , it has any json in it ? Commented Jan 14, 2016 at 7:45
  • No extra json in my response... as expected, this is the correct behaviour Commented Jan 14, 2016 at 7:48

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.