Search
 
SCRIPT & CODE EXAMPLE
 

PHP

laravel if file is image

$allowedMimeTypes = ['image/jpeg','image/gif','image/png'];
$contentType = $request->file->getClientMimeType();

if(! in_array($contentType, $allowedMimeTypes) ){
  return response()->json('error: Not an image');
}else{
  return $this->productService->storeImage($request->file);
}
Comment

PREVIOUS NEXT
Code Example
Php :: php store log in a text file 
Php :: convert string to datetime symfony 
Php :: new line php 
Php :: how to print count query in php 
Php :: how to convert string word to lowercase in php 
Php :: get number of chars ina string php 
Php :: php add one day to date 
Php :: Allowed memory size of 1610612736 bytes exhausted (tried to allocate 67108872 bytes) in phar:///usr/local/bin/composer1.phar/src/Composer/DependencyResolver/RuleSet.php on line 8 
Php :: laravel websockets onclose 
Php :: laravel auth ui command 
Php :: laravel check pagination in blade 
Php :: Pacific Daylight Time Zone php 
Php :: yii2 arraydataprovider 
Php :: php artisan up 
Php :: array should not be empty php 
Php :: convert string to lowercase in php 
Php :: php force download csv 
Php :: get categories wordpress query 
Php :: print last sql query laravel 
Php :: php intl 
Php :: php object(stdclass) to array 
Php :: slp price php 
Php :: php echo alot of html 
Php :: php confirm box 
Php :: get name custom post type wordpress 
Php :: laravel string capitalize in view 
Php :: foreignid in laravel 
Php :: continue php 
Php :: difference of two dates in seconds php 
Php :: php random 5 digit number 
ADD CONTENT
Topic
Content
Source link
Name
3+2 =