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 :: save html form data to text file using php 
Php :: Find ip address location php 
Php :: php newline 
Php :: carbon now format 
Php :: php date today plus 1 month 
Php :: get domain from subdomain php 
Php :: laravel transactions 
Php :: php refresh page 
Php :: php regex validate username 
Php :: whereyear laravel 
Php :: php truncate string 
Php :: php move file 
Php :: make a seeding file in laravel 
Php :: get last two numbers from int php 
Php :: how to add properties to the request object 
Php :: php string max length 
Php :: for loop php continue to next item 
Php :: how to run symfony project 
Php :: how to create a new component in laravel 
Php :: php check if variable is int 
Php :: laravel plural 
Php :: php get all function arguments 
Php :: remove slashes from json php 
Php :: get http method php 
Php :: get post thumbnail url 
Php :: laravel create model with migration and controller 
Php :: do shortcode wordpress 
Php :: how to check number only in php 
Php :: php json hjeader 
Php :: use if in laravel blade 
ADD CONTENT
Topic
Content
Source link
Name
2+7 =