Laravel 5 File upload, storage and download

For this tutorial what we want to achieve is to have a file upload and download system in our Laravel 5 application using the new Storage features. The example is intentionally easy but you can easily extend the concept.

For the purpose we are going to create a database table where we store the file informations. This is needed when we  download the file from the application. With the abstraction of the Storage API you can save the file where you like, locally on the local disk like in the example or Amazon S3 servers, or others.

Laravel 5 and AngularJS Tutorial

For this first Laravel 5 and AngularJS tutorial we are going to build a simple Todo Application. We will use the resource routing of Laravel 5 to crete a REST API for the backend of the application and the powerfull of AngularJS for the frontend.

This tutorial suppose you have already installed Laravel and all the LAMP stack on your development machine. If not, i can suggest you to follow the official Laravel guide to get Vagrant Homestead installed.

File upload to GridFS on MEAN stack – MeanJS

Last day i was excited when reading about the GridFS feature of mongoDB.

GridFS is a specification for storing and retrieving files that exceed the BSON-document size limit of 16MB.

Instead of storing a file in a single document, GridFS divides a file into parts, or chunks, and stores each of those chunks as a separate document. By default GridFS limits chunk size to 255k. GridFS uses two collections to store files. One collection stores the file chunks, and the other stores file metadata.

MongoDB site

What we want to achieve with this tutorial is the ability for our app to upload a file from a form and save it to a mongoDB – GridFS store and the retrive it with a GET call.

Shares
Share This

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close