Laravel 5 Ajax 文件/图片上传
本文介绍了Laravel 5 Ajax 文件/图片上传的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的 Laravel ajax 应用程序有问题,
我无法通过 ajax POST 上传图片/文件.
这是我的代码.
阿贾克斯..
刀片模板...
控制器..
路线..
我的代码有什么错误???
我无法在 Laravel 控制器中获取文件信息..
我该如何解决这个问题...?
解决方案
有两点需要改变:
从以下位置更改您的 js 文件:
致:
因为您想发送整个表格.
在您的 html 中:
为您的文件输入字段添加名称
致:
I have an issue in my laravel ajax application,
I cant upload images/files through ajax POST.
here is my code.
Ajax..
Blade template ...
Controller ..
Route ..
What is the error in my code ???
I cant get the file information in laravel controller..
How can i solve this issue...?
解决方案
Two things to change:
Change your js file from:
To:
Because you would like to send the whole form.
In your html:
Add a name to your file input field
To:
这篇关于Laravel 5 Ajax 文件/图片上传的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!