Laravel 8 - How to move file from one folder to another folder

Laravel 8 - How to move file from one folder to another folder

In this Laravel Tutorial, I will let you know how to move one file from one folder to another with example.

There are some common and general activity that you usually do on your computer and moving files from one location to another is one of them.

If you are familiar with Linux then there is also a command mv to move file that needs source and destination. In Laravel, we can achieve it by using move method with File or Storage Facade.

Move file using File Facade

You can use below line of code to move file from one path to another, you just need to replace the from_path and to_path to their actual path

File::move(from_path, to_path);
Move file using Storage Facade

You can also use Storage Facade to move file:

Storage::move(from_path, to_path);

Let's suppose you want to move the file 'file1.jpg' from old directory to new directory then you can use below line of code

Storage::move('old/file.jpg', 'new/file.jpg');

Phone: (+91) 8800417876
Noida, 201301
sakarya escort akyazı escort arifiye escort erenler escort eve gelen escort ferizli escort geyve escort hendek escort otele gelen escort sapanca escort söğütlü escort taraklı escort
sakarya escort akyazı escort arifiye escort erenler escort eve gelen escort ferizli escort geyve escort hendek escort karapürçek escort karasu escort kaynarca escort kocaali escort otele gelen escort pamukova escort sapanca escort söğütlü escort taraklı escort
sakarya escort akyazı escort arifiye escort erenler escort eve gelen escort ferizli escort geyve escort hendek escort karapürçek escort karasu escort kaynarca escort kocaali escort otele gelen escort pamukova escort sapanca escort söğütlü escort taraklı escort
sakarya escort akyazı escort arifiye escort erenler escort eve gelen escort ferizli escort geyve escort hendek escort karapürçek escort karasu escort kaynarca escort kocaali escort otele gelen escort pamukova escort sapanca escort söğütlü escort taraklı escort
sakarya escort sakarya escort sakarya escort sakarya escort sakarya escort sakarya escort sakarya escort sakarya escort sakarya escort sakarya escort izmit escort sakarya escort sapanca escort sakarya escort