You cannot do this for the following reasons:
- Several host machines are running on your computer. Each of them has its own file systems. Each running process in your application will display a different set of files.
- The host machines that your particular application runs on can change instantly. In fact, they will change every time you redeploy the application. Each time the process starts on a new host computer, it sees an empty set of files. Each time the process stops on the old machine, all files will be deleted permanently.
You absolutely must solve this problem differently.
- Save the media files to the MongoDB GridFS file.
- Store media files in a storage facility such as Amazon S3 or Rackspace cloud files.
source share