如何在Laravel和vie-fiepond中将文件对象发送到服务器

时间:2020-05-25 15:44:20

标签: laravel filepond

我已经将vue-filepond用于前端应用程序,而aslo后端则由Laravel编写。

链接:https://pqina.nl/filepond/docs/patterns/frameworks/vue

我的问题是,何时不将文件发送到服务器。如何在服务器端获取文件对象? 这是我的filepond标记:

    <file-pond
            name="file"
            ref="pond"
            label-idle="Click here of drag your file..."
            v-bind:allow-multiple="false"
            imageCropAspectRatio="1:1"
            imageResizeTargetWidth="200"
            allowImagePreview="true"
            imagePreviewMinHeight="60"
            imagePreviewMaxHeight="200"
            imagePreviewHeight="80"
            imagePreviewMaxFileSize="100m"
            allowImageCrop="true"
            allowImageEdit="true"
            imageEditInstantEdit="false"
            imageEditAllowEdit="true"
            imageResizeTargetHeight="500"
            allowImageExifOrientation="true"
            stylePanelLayout="compact circle"
            styleLoadIndicatorPosition="center bottom"
            labelFileLoading="file is sending to server ..."
            labelFileProcessing="file is sending to server ..."
            styleButtonRemoveItemPosition="center bottom"
            styleImageEditButtonEditItemPosition="bottom center"
            accepted-file-types="image/jpeg, image/png"
            server="/api/user/avatar/upload"
            v-bind:files="myFiles"
            v-on:init="handleFilePondInit"
            v-on:addfilestart="handleOnaddfilestart"
            v-on:addfile="handleOnaddfile"
            v-on:processfileprogress="handleOnprocessfileprogress"
            v-on:addfileprogress="handleOnaddfileprogress"
            v-on:processfilestart="handleOnprocessfilestart"
            v-on:error="handleOnerror"
            v-on:processfileabort="handleOnprocessfileabort"
            v-on:processfilerevert="handleOnprocessfilerevert"
            v-on:processfile="handleOnprocessfile"
            v-on:updatefiles="handleOnupdatefiles"
    />

但是当我转到/ api / user / avatar / upload路径时,我在$ request-> file('file')请求中得到了空值。

0 个答案:

没有答案