php - Send file with postman to Laravel API -


When I try to send a file from the postman to my Larjal API, the result always "nulls"

My controllers look like this:

  public function archive () {$ file = input :: file ('image'); Var_dump ($ file); }  

and my route file:

  root: post ('test', 'testcontroller @ store');  

But when I try to send an image in the postman, I get the result "NULL"

My Postman is Confirm:

(POST)

content-type - multipart / form-data

form-data

image - test.jpg

Anything missing?

I have checked php.ini so that I have enough room for upload

My problem is similar in this post:

but its solution I have already checked my php.ini

The code works as a resource if I use a resource controller and put the url in a browser:

< Pre> public function store () {$ input = input :: all (); $ Path = public_path () '/ Images / 123 /'; $ Inpusqt = Input :: File ('Picture'); $ I = 1; File :: exists ($ path) or file :: create directory ($ path); Foreign currency ($ INPUSQT $ as file) {$ filExt = $ file-> GetClientOriginalExtension (); $ Ext = '.' . $ FilExt; $ Lol = Image :: Creating ($ file-> GetRealPath ()); $ Lol- & gt; High (258) - & gt; Save ($ path. $ I. $ Ext); $ I ++; // increase value to give each image a uniqe name}}

But if I modify my path for example: (Controller @ Store) and images with Postmen It is an error saying that "undefined index: images"

If you are a postman and larval If you want to test file uploads, just remove the content-type header settings in the postman .


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -