I have a folder where Im uploading images of different format.The file extension can be jpg/png/gif.
Eg : id_proof.png
id_proof.jpg
id_proof.gif
but the file name remains the same.Now how can I show up this file by just the name of the file.Right now what I am doing is
$path1 = "/var/www/html/merchant/images/".$merchant_user_id."/id_proof.png";
but now that the file extension can be either of the 3 , how will I be able to read it without a file extension ?Please help out.
User path inside a loop:
$extensions = array( 'jpg', 'png', 'gif' );
foreach( $extensions as $ext ){
$path = "/var/www/html/merchant/images/" . $merchant_user_id . "/id_proof." . $ext;
if( is_file( $path ) ){
// do something with path
}
}
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments