Search
 
SCRIPT & CODE EXAMPLE
 

PHP

php get file extension from filename

$ext = pathinfo($filename, PATHINFO_EXTENSION);
Comment

php get filename without extension

// Here is a quick way of fetching only the filename (without extension) regardless of what suffix the file has.

// your file
$file = 'image.jpg';
$info = pathinfo($file);
// Before PHP 5.2
$file_name =  basename($file, '.'.$info['extension']);
// After PHP 5.2
$file_name =  $info['filename'];
Comment

php get filename without extension

pathinfo($path, PATHINFO_FILENAME);
Comment

get extension from filename php

// your file
$file = 'image.jpg';
$info = pathinfo($file);
// Before PHP 5.2
$file_name =  basename($file, '.'.$info['extension']);
// After PHP 5.2
$file_name =  $info['filename'];
Comment

Get File Extension PHP

//Get File Extension
function getFileExtension($fileName)
{
    return '.' . strtolower(pathinfo($fileName, PATHINFO_EXTENSION));
}
Comment

PREVIOUS NEXT
Code Example
Php :: time in php 
Php :: Remove public or index file from url in laravel 
Php :: laravel model limit 
Php :: laravel hasmany count 
Php :: php start of day epoch 
Php :: compile custom/plain css with mix in laravel 
Php :: merge two arrays one as key to another php 
Php :: enum in laravel migration 
Php :: web scraping php 
Php :: session variable in laravel 
Php :: php in html attributes 
Php :: yyyymmdd to yyyy-mm-dd php 
Php :: how to bulk insert array into sql php 
Php :: livewire sortable 
Php :: change php version in linux 
Php :: image validate in laravel validater 
Php :: php array to string 
Php :: require in php 
Php :: select values from mysql using php array of ids 
Php :: lumen file upload 
Php :: laravel model update 
Php :: laravel log could not be opened fix 
Php :: cloudflare ip country 
Php :: regex php password 
Php :: unset session key 
Php :: remove text keep numbers only php 
Php :: how to get data from a table in laravel 
Php :: Regex For Iranian Phone Numbers 
Php :: laravel collection keys 
Php :: how to set cookie expire time in php 
ADD CONTENT
Topic
Content
Source link
Name
3+6 =