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 | | 2881 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 | | 761 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 | | 761 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 | | 661 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 | | 2662 Viewer | Category : PHP
READ MORE

    Laravel 5 - Example of Database Seeder with insert sample data

    Laravel 5 - Example of Database Seeder with insert sample data

    Open Post

    Laravel 5 amazon s3 file upload tutorial - Part 1

    Laravel 5 amazon s3 file upload tutorial - Part 1

    Open Post

    PHP - jquery ajax crop image before upload using croppie plugin

    PHP - jquery ajax crop image before upload using croppie plugin

    Open Post

    How to get location information from ip address in Laravel ?

    How to get location information from ip address in Laravel ?

    Open Post

    Laravel 5 - Simple user access control using Middleware

    Laravel 5 - Simple user access control using Middleware

    Open Post

    Laravel 5 - How to create API Authentication using Passport ?

    Laravel 5 - How to create API Authentication using Passport ?

    Open Post