add upload files
Tests & Lint & Deploy to Railway / build (8.1) (push) Successful in 1m40s Details
Tests & Lint & Deploy to Railway / deploy (8.1) (push) Failing after 1m16s Details

This commit is contained in:
AslanAV 2024-01-17 09:01:14 +03:00
parent 6f6dbdefad
commit ce6a387101
2 changed files with 43 additions and 8 deletions

View File

@ -0,0 +1,40 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class UploadFileController extends Controller
{
public function index()
{
return view('uploadfile');
}
public function showUploadFile(Request $request)
{
$file = $request->file('image');
//Display File Name
echo 'File Name: ' . $file->getClientOriginalName();
echo '<br>';
//Display File Extension
echo 'File Extension: ' . $file->getClientOriginalExtension();
echo '<br>';
//Display File Real Path
echo 'File Real Path: ' . $file->getRealPath();
echo '<br>';
//Display File Size
echo 'File Size: ' . $file->getSize();
echo '<br>';
//Display File Mime Type
echo 'File Mime Type: ' . $file->getMimeType();
//Move Uploaded File
$destinationPath = 'uploads';
$file->move($destinationPath, $file->getClientOriginalName());
}
}

View File

@ -25,21 +25,16 @@ Route::resource('/users', UserController::class);
Route::get('/home', function () { Route::get('/home', function () {
return view('home'); return view('home');
}); });
Route::get('/course', function () { Route::get('/course', function () {
return view('pages.course'); return view('pages.course');
}); });
Route::get('/abitur', function () { Route::get('/abitur', function () {
return view('pages.abitur'); return view('pages.abitur');
Route::post('/uploadfile', [UploadFileController::class, 'showUploadFile'])->name('uploadfile');
Route::get('/test', function () {
return view('test');
}); });
Route::post('/uploadfile', [UploadFileController::class, 'showUploadFile'])->name('uploadfile');
Route::get('/dashboard', function () {
return view('dashboard');
})->middleware(['auth', 'verified'])->name('dashboard');
Route::get('/dashboard', function () { Route::get('/dashboard', function () {
return view('dashboard'); return view('dashboard');