It uses the upload component of iview, and the backend uses laravel to get the uploaded image.

the front end uses the upload component of iview to upload pictures, and the back end uses laravel5.6 to upload pictures. It is found that the picture content is empty using $request- > all () , as shown in the following figure

.



$_FILES

I don"t know what the problem is. Now I need to use $request- > file ("avatar") to get it. How can I solve it?


print $request- > headers to see what Content-Type is, usually when Content-Type is wrong.


the problem certainly doesn't lie in iview, because I've tried it with iview. Php can get pictures natively, using $_ FILES

but I didn't try it with laravel5.6.
the problem should lie in the use of your laravel5.6. There must be something wrong with the posture. I suggest you take a good look at the document. I haven't used this framework to help you eliminate the front-end problems. I can only help you so far.


isn't the backend supposed to be $req- > file ('avatar') ?


clipboard.png
official documents don't say you can use $request- > all () to get uploaded files

.
Menu