php
Get file name form url in PHP
<?php
$url = "https://remote-url-path/filename.jpg";
echo basename($url);
?>
Output
filename.jpg
If you want to get file name form a URL or path in PHP you can use basename() function in PHP. It will return the file filename when the URL is passed as a parameter.
Was this helpful?
Similar Posts
- Download file from remote url to user desktop in PHP
- PHP Script to download image from remote url
- Get values array by key name using array_column() PHP
- PHP program to get the values of checkboxes on Form Submit
- Convert String date to DATE MONTH-NAME YEAR format php
- Check if file exist in PHP
- Read file content using PHP