如何解决FilePond 向服务器发送空白请求
我使用 Laravel-filepond 和 Vue FilePond。
但是 FilePond 向服务器发送一个空白请求。
这是我的代码:
*UserComponent.vue
<template>
<div class="container">
<file-pond
name="Profile"
ref="pond"
label-idle="drag & drop"
v-bind:allow-multiple="false"
accepted-file-types="image/jpeg,image/png"
v-bind:files="userFile"
v-bind:server="{
url: '/panel/filepond',timeout: 7000,process: {
url: '/process',method: 'POST',headers: {
'X-CSRF-TOKEN': this.get_Meta('csrf-token'),},}
}"
v-on:init="handleFilePondInit"/>
</div>
</template>
<script>
import vueFilePond,{setoptions} from 'vue-filepond';
import 'filepond/dist/filepond.min.css';
import 'filepond-plugin-image-preview/dist/filepond-plugin-image-preview.min.css';
import FilePondpluginFileValidateType from 'filepond-plugin-file-validate-type';
import FilePondpluginImagePreview from 'filepond-plugin-image-preview';
import FilePondpluginImageEdit from 'filepond-plugin-image-edit';
const FilePond = vueFilePond(FilePondpluginFileValidateType,FilePondpluginImagePreview);
export default {
data() {
return {
userFile: [],}
},methods: {
handleFilePondInit: function () {
console.log('FilePond has initialized');
}
},components: {
FilePond
},}
</script>
FilePondController.PHP Original file
<?PHP
namespace Sopamo\LaravelFilepond\Http\Controllers;
use function dd;
use Illuminate\Http\Request;
use Illuminate\Routing\Controller as BaseController;
use Sopamo\LaravelFilepond\Filepond;
class FilepondController extends BaseController
{
private $filepond;
public function __construct(Filepond $filepond)
{
$this->filepond = $filepond;
}
public function upload(Request $request)
{
dd($request->all());
}
}
当我在客户端上传文件时(默认响应为 422),我在我的服务器上找不到它。
FrameWorks & Repository 是最新版本。
响应
[]
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。