mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 04:23:55 +00:00
Revert previous testing code
This commit is contained in:
@@ -1,50 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\AWS;
|
||||
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
|
||||
class AWSImageUploadController extends Controller
|
||||
|
||||
{
|
||||
|
||||
public function imageUpload()
|
||||
{
|
||||
return view('pages.aws_image_upload');
|
||||
}
|
||||
|
||||
|
||||
public function imageUploadPost(Request $request)
|
||||
{
|
||||
$request->validate([
|
||||
'image' => 'required|image|mimes:jpeg,png,jpg,gif,svg|max:2048',
|
||||
]);
|
||||
|
||||
$imageName = time().'.'.$request->image->extension();
|
||||
|
||||
$request->image->storeAs('images', $imageName);
|
||||
|
||||
return back()
|
||||
->with('success','You have successfully upload image.')
|
||||
->with('image',$imageName);
|
||||
}
|
||||
|
||||
|
||||
public function displayImage($fileName)
|
||||
{
|
||||
$path = 'images/'.$fileName;
|
||||
$file = Storage::get($path);
|
||||
$type = Storage::mimeType($path);
|
||||
|
||||
$response = Response::make($file, 200);
|
||||
$response->header("Content-Type", $type);
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
@extends('layouts.base_portal')
|
||||
@section('inner_content')
|
||||
<div class="container">
|
||||
<div class="panel panel-primary">
|
||||
<div class="panel-heading"><h2>Image Upload with Laravel Vapor</h2></div>
|
||||
<div class="panel-body">
|
||||
|
||||
@if ($message = Session::get('success'))
|
||||
<div class="alert alert-success alert-block">
|
||||
<button type="button" class="close" data-dismiss="alert">×</button>
|
||||
<strong>{{ $message }}</strong>
|
||||
</div>
|
||||
<img src="{{ route('aws.image.displayImage', Session::get('image')) }}" style="width: 400px">
|
||||
@endif
|
||||
|
||||
@if (count($errors) > 0)
|
||||
<div class="alert alert-danger">
|
||||
<strong>Whoops!</strong> There were some problems with your input.
|
||||
<ul>
|
||||
@foreach ($errors->all() as $error)
|
||||
<li>{{ $error }}</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
|
||||
<form action="{{ route('aws.image.upload.post') }}" method="POST" enctype="multipart/form-data">
|
||||
@csrf
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<input type="file" name="image" class="form-control">
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<button type="submit" class="btn btn-success">Upload</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
@@ -601,8 +601,3 @@ Route::get('/po/outsource/check', function(){
|
||||
Route::get('/upload-honey-trap', function () {
|
||||
return view('pages.honey_trap');
|
||||
})->name('upload_honey_trap');
|
||||
|
||||
|
||||
Route::get('/aws-image-upload', 'AWS\AWSImageUploadController@imageUpload')->name('aws.image.upload');
|
||||
Route::post('/aws-image-upload', 'AWS\AWSImageUploadController@imageUploadPost')->name('aws.image.upload.post');
|
||||
Route::get('/aws-image/{filename}', 'AWS\AWSImageUploadController@displayImage')->name('aws.image.displayImage');
|
||||
|
||||
Reference in New Issue
Block a user