Tag : Directory


How to get size of directory in MB Laravel 5?

Mostly we require to calculate for uploaded directory size because we can see how much we size allocate in uploaded directory. If you have limited server then you always need to check how much size of data in my folder. You can also get size of directory that way you can also display on your admin panel. Laravel provide File facade. File facade through we can get folder size in kb or mb or gb etc. In bellow example i have <strong class="path">images directory</strong> in public folder. so we can get size for images folder like this way : <strong>Example:</strong> <pre class="prettyprint la.....

By Hardik Savani | July 23, 2016 | | 2055 Viewer | Category : Laravel
READ MORE

How to get folder path from file path in PHP?

Sometimes, we require to get directory path from Image path or file url in our PHP website or any PHP framework website at that time we can get folder name using php pre-define function dirname. If you ever use this function then you can see as bellow example how it's works. I have one image url like, i want to just get folder path then you can get folder path like this way : <strong>Example:</strong> <pre class="prettyprint lang-php"> dirname('http://localhost:8000/upload/images/test.jpg'); </pre>

By Hardik Savani | July 4, 2016 | | 604 Viewer | Category : PHP
READ MORE

How to check file is exists or not in PHP?

If you need to check file is exixt or not on folder. Normally we require to check image is exist or not, video is exists or not etc. In this example i use file_exists() for determine file is available or not in given path. So if you also need check then follow bellow example: <strong>Example:</strong> <pre class="prettyprint lang-php"> if(file_exists('./upload/flower.jpg')){ print_r('Image is exist.'); }else{ print_r('Image is not exist.'); } </pre>

By Hardik Savani | April 26, 2016 | | 608 Viewer | Category : PHP
READ MORE

How to recursively change the permissions of files and directories in ubuntu?

Sometimes, we need to give recursively change the permissions of specific files and directories in ubuntu OS. you can open terminal and run bellow command, so let's try this way : <strong class="example">Example</strong> <pre>sudo find foldername -exec chmod a+rwx {} ";"</pre> Give more specific! <pre>sudo find foldername -type d -exec chmod 755 {} ";"</pre> <pre>sudo find foldername -type f -exec chmod 644 {} ";"</pre>

By Hardik Savani | April 6, 2016 | | 522 Viewer | Category : Ubuntu
READ MORE

How to count number of files in directory PHP?

If you are working on code php and you require to count number of files, images, zip file, rar files, etc in the given folder path, then you can count using glob() and count() of php. So, let's see this bellow example and learn how it done. <strong class="example"></strong> <pre class="prettyprint lang-php"> $folderPath = "upload/"; $countFile = 0; $totalFiles = glob($folderPath . "*"); if ($totalFiles){ $countFile = count($totalFiles); } print_r($countFile); </pre>

By Hardik Savani | March 14, 2016 | | 2088 Viewer | Category : PHP
READ MORE

    Laravel 5 - Barcode generator example using milon/barcode package

    Laravel 5 - Barcode generator example using milon/barcode package

    Open Post

    Laravel 5.3 - import export csv and excel file into database

    Laravel 5.3 - import export csv and excel file into database

    Open Post

    Bootstrap daterangepicker example code with demo using daterangepicker.js

    Bootstrap daterangepicker example code with demo using daterangepicker.js

    Open Post

    How to implement flash messages in PHP Codeigniter?

    How to implement flash messages in PHP Codeigniter?

    Open Post

    How to get keys name from array using array helper in PHP Laravel ?

    How to get keys name from array using array helper in PHP Laravel ?

    Open Post

    PHP - How to Convert file(image, audio, video) extension using CloudConvert API?

    PHP - How to Convert file(image, audio, video) extension using CloudConvert API?

    Open Post