Search
 
SCRIPT & CODE EXAMPLE
 

PHP

laravel rename file if exists

function newName2($fullpath) {
  $path = dirname($fullpath);
  if (!file_exists($fullpath)) return $fullpath;
  $fnameNoExt = pathinfo($fullpath,PATHINFO_FILENAME);
  $ext = pathinfo($fullpath, PATHINFO_EXTENSION);

  $i = 1;
  while(file_exists("$path/$fnameNoExt ($i).$ext")) $i++;
  return "$path/$fnameNoExt ($i).$ext";
}
Comment

PREVIOUS NEXT
Code Example
Php :: laravel eloquent query with orderBy subquery 
Php :: laravel load relationship including empty values 
Php :: laravel get previous route without domain 
Php :: how to read laravel query string with dash 
Php :: Laravel display the date the participation was created 
Php :: order by array like sql php 
Php :: laravel ailed: WebSocket opening handshake was canceled 
Php :: set modes magento 2 
Php :: hirudhi 
Php :: PHP vprintf — Output a formatted string 
Php :: How to get ID and other string in url 
Php :: symfony user online 
Php :: gmail smtp not working laravel 
Php :: encode string for csv 
Php :: php $_POST contains 
Php :: cara looping abjad with array 
Php :: laravel Undefined index: token on reset 
Php :: laravel 8 crud api example 
Php :: how return cutomize error text the firstOrFail laravel exeption 
Php :: create product model in laravel 
Php :: undefined variable require_once 
Php :: kinsta check environment 
Php :: Comment ajouter nofollow à un lien spécifique ou à tous les liens WordPress dans the_content 
Php :: php ussd 
Php :: Eagar loading,parent child relationship,Sub relationship in laravel 
Php :: how to create php message 2 
Php :: eager loading set limit to relationship 
Php :: override CouponPost.php 
Php :: submit form and send email in php 
Php :: refresh database tables yii 1 
ADD CONTENT
Topic
Content
Source link
Name
1+1 =