fsdolphin
2 years ago

Understanding the move and the storeAs methods for saving/uploading files to the filesystem

Posted 2 years ago by fsdolphin

This is my first time uploading files and I have been watching videos and some online tutorials and I noticed that there are a few ways to do the upload which is a little overwhelming by not understanding the use cases.

I have seen people using the move() method, some others use the storeAs() method, some others using Storage::disk() and some other using request()->file()->store(), anyways for now I would like to focus on the move() and the storeAs() methods.

Can someone give me a quick explanation on when would you use one over the other?

Illuminate/Http/UploadedFile

storeAs()

// Store the uploaded file on a filesystem disk.

Illuminate/Filesystem/Filesystem

move()

// Move a file to a new location.

Please sign in or create an account to participate in this conversation.