Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Merge pull request #2 from logicsolutions-jimmy-fang/master

file storage
  • Loading branch information
r567tw committed Oct 7, 2019
2 parents 0d29855 + 28ae22b commit 85ba735bbf1144c9c4ea7d5aae142441d59f7871
Showing with 52 additions and 0 deletions.
  1. +19 −0 app/Http/Controllers/UploadController.php
  2. +27 −0 resources/views/fileUpload.blade.php
  3. +6 −0 routes/web.php
@@ -0,0 +1,19 @@
<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use Storage;

class UploadController extends Controller
{
//
public function uploadPage(){
return view('fileUpload');
}

public function upload(Request $request){
Storage::put('test.jpg', $request->file('ImageFile')->get());
return view('fileUpload')->withMessage('Success Upload');
}
}
@@ -0,0 +1,27 @@
@extends('layouts.app')

@section('content')
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card">
@if (isset($message))
<div class="alert alert-success" role="alert">
{{ $message }}
</div>
@endif
<div class="row justify-content-center">
<form class="form" action="" method="POST" enctype="multipart/form-data">
@csrf
<div class="form-group">
<label for="">檔案上傳</label>
<input class="form-control-file" type="file" name="ImageFile" id="" accept="image/*"/>
</div>
<button class="btn btn-primary" type="submit">送出</button>
</form>
</div>
</div>
</div>
</div>
</div>
@endsection
@@ -27,3 +27,9 @@
Route::get('middlewareTest', function () {
return 'Hello example@example.com';
})->middleware('FirstMiddleware');

Route::get('upload','UploadController@uploadPage');
Route::post('upload','UploadController@upload');



0 comments on commit 85ba735

Please sign in to comment.
You can’t perform that action at this time.