Search
 
SCRIPT & CODE EXAMPLE
 

PHP

File/Image store in Laravel

   $request->validate([
            'image' => 'required|image|mimes:jpeg,png,jpg,gif,svg|max:2048',
        ]);
        
        
$imageName = time() . '.' . $request->image->extension(); 
        
Store in Storage folder
$request->image->storeAs('images', $imageName);
// storage/app/images/file.png



Store in Public Folder
$request->image->move(public_path('images'), $imageName);
// public/images/file.png


Store in S3
$request->image->storeAs('images', $imageName, 's3');


  

// public/images/file.png
Comment

laravel save file or picture directory

$dir_ktp = 'frontend/assets/img/foto_ktp/' . date('Y') . '/' . date('m');
$ext_ktp = $input['foto_ktp']->getClientOriginalExtension();
$ktp = $dir_ktp . '/' . Str::random(20) . '_' . date('d') . '_' . md5(time())  . '.' . $ext_ktp;
$input['foto_ktp']->move(public_path($dir_ktp), $ktp);
Comment

PREVIOUS NEXT
Code Example
Php :: laravel request file empty 
Php :: Laravel permission to Vuejs 
Php :: laravel migration change column order 
Php :: how to add javascript to a php variable 
Php :: how to filter laravel eloquent 
Php :: number text short in laravel 
Php :: curl download progress bar php 
Php :: test php code online free 
Php :: json decode 
Php :: macrotime phph 
Php :: this app is not allowed to query for scheme fb-messenger" 
Php :: how to add x-xss-protection header 
Php :: silverstripe image upload field 
Php :: multiple ternary operator in php 
Php :: laravel auth sha-1 
Php :: install composer laravel 
Php :: Use external variable in array_filter 
Php :: woocommerce php reset password length 
Php :: laravel pest assertstatus 
Php :: How can I get current controller in yii2 
Php :: octobercms mail register 
Php :: php pagination ellipsis 
Php :: wordpress convert object to array 
Php :: map array php 
Php :: laravel reroute 419 
Php :: Create progress bar with Laravel 
Php :: php receive request 
Php :: php number formatter 
Php :: laravel collection shift 
Php :: group by count mongodb laravel 
ADD CONTENT
Topic
Content
Source link
Name
8+7 =