fix upload, obrazok nazov

This commit is contained in:
2021-01-31 08:18:48 +01:00
parent a494bf208f
commit 7c1d861a7d
2 changed files with 8 additions and 2 deletions

View File

@@ -3,6 +3,7 @@
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Carbon\Carbon;
class Upload extends Controller
{
@@ -37,10 +38,14 @@ class Upload extends Controller
// File upload location
$location = 'upload/images';
$backupdir = Carbon::now()->format('Y/m/d');
$backupdir = 'upload/images/backup/' + $backupdir;
$bckfile = Carbon::now()->format('Hi');
$bckfile = $bckfile + '.jpg';
// Upload file
$file->copy($backupdir,$bckfile);
$file->move($location,$filename);
echo 'Upload Successful.';
}else{
echo 'File too large. File must be less than 2MB.';