Im new to the laravel 5.4.but i have to create file uploading system.if it is a PDF files,and other documents 1,Upload them seperatly 2, delete or download it them seperatly. as i
m new to laravel .i started like this can anyone help me to function it properly?
here is my UploadController
class UploadController extends Controller
{
public function index(){
return view('upload.index');
}
public function multiple_upload(){
$files = Input::file('images');
$extention = $file ->getClientOriginalExtention();
$entry = new Uploads();
$entry -> mime = $files ->getClientMimeType();
$entry -> filename = $files ->getFilename().'.'.$extention;
$entry -> save();
}
}
Here Is my Routes
Route::get('upload', 'UploadController@index');
Route::post('upload/uploadFiles', 'UserController@multiple_upload');
Here Is my View index.blade.php
<form action="upload" id="upload" enctype="multipart/form-data" >
<label>Uplod your Attachments</label>
<input type="file" name="file[]" multiple="" >
<input type="submit" >
</form>
Here Is My Migration
Schema::create('upload_3a12', function (Blueprint $table) {
$table->increments('id');
$table->string('filename');
$table->string('mime');
$table->timestamps();
});
Hope You will help me lot. Thank you.
via Dasun