我正在使用uploadify在 laravel 中通过进度条实现上传文件。但是当我上传文件时,我在控制台中收到此错误。
Uncaught TypeError: $(...).find(...).not(...).size is not a function
at HTMLInputElement.<anonymous> (jquery.uploadifive.js:814)
at Function.each (jquery-3.5.1.min.js:2)
at S.fn.init.each (jquery-3.5.1.min.js:2)
at S.fn.init.upload (jquery.uploadifive.js:770)
at S.fn.init.$.fn.uploadifive (jquery.uploadifive.js:872)
at <anonymous>:1:19
我正在使用 laravel,刀片视图是
uploadForm.blade.php
@extends('layouts.artist')
@section('content')
<div id="queue"></div>
<input id="file_upload" name="file_upload" type="file" multiple="true">
<a style="position: relative; top: 8px;" href="javascript:$('#file_upload').uploadifive('upload')">Upload Files</a>
@endsection
@section('script')
<script type="text/javascript">
$(function() {
$('#file_upload').uploadifive({
'auto' : false,
'checkScript' : '',
'fileType' : 'image/png',
'formData' : {
'_token' : "{{csrf_token()}}"
},
'queueID' : 'queue',
'uploadScript' : "{{route('track.upload')}}",
'onUploadComplete' : function(file, data) { console.log(data); }
});
});
</script>
@endsection
我的控制器就是这个
TrackController.php
function upload(Request $request) {
$title = rand(1000000, 9999999);
$request->file_upload->storeAs('public/uploads', $title.'.png');
$response = ['status' => 'ok', 'message' => $title.' successfully uploaded.'];
return response()->json($response);
}
非常感谢任何帮助。