Php 如何在laravel中使用队列上传文件?
我是拉威尔的初学者。我想使用Laravel中的队列上载文件。我在laravel中创建了一个上载文件的简单示例,但我不知道如何使用带有上载文件的队列 index.blade.phpPhp 如何在laravel中使用队列上传文件?,php,laravel,laravel-5,queue,Php,Laravel,Laravel 5,Queue,我是拉威尔的初学者。我想使用Laravel中的队列上载文件。我在laravel中创建了一个上载文件的简单示例,但我不知道如何使用带有上载文件的队列 index.blade.php <h2>Upload file</h2> <form action="{{ route('file.store') }}" method="post" enctype="multipart/form-data">
<h2>Upload file</h2>
<form action="{{ route('file.store') }}" method="post" enctype="multipart/form-data">
{{{-- csrf_field(): This function can be used to generate the hidden input field in the HTML form. --}}}
{{{-- Note: This function should be written inside double curly braces. --}}}
{{ csrf_field()}}
<label for="file">Please choose a file to upload</label>
<input type="file" name="file" id="file"><br>
<button type="submit">Upload</button>
</form>
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class FileController extends Controller
{
public function index()
{
return view('file.index');
}
public function store(Request $request)
{
$file = $request->file('file')->store('uploads', 'public');
}
}
上传文件
{{--csrf_field():此函数可用于生成HTML表单中的隐藏输入字段。-}}
{{--注意:这个函数应该写在双大括号内。-}}
{{csrf_field()}}
请选择要上载的文件
上传
FileController.php
<h2>Upload file</h2>
<form action="{{ route('file.store') }}" method="post" enctype="multipart/form-data">
{{{-- csrf_field(): This function can be used to generate the hidden input field in the HTML form. --}}}
{{{-- Note: This function should be written inside double curly braces. --}}}
{{ csrf_field()}}
<label for="file">Please choose a file to upload</label>
<input type="file" name="file" id="file"><br>
<button type="submit">Upload</button>
</form>
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class FileController extends Controller
{
public function index()
{
return view('file.index');
}
public function store(Request $request)
{
$file = $request->file('file')->store('uploads', 'public');
}
}