danWilcz's avatar

Uploads to Cloud

My Problem: I don't want to store uploaded images on my web app server for security reasons. I don't want to make a mistake and if its stored on a separate server that means less things that can go wrong.

The way I understand things, with php when uploading files:

A user uploads it goes to /tmp on server where it is stored temporarily (until php process stops).

In Laravel I can use $request->file('image')->move($destination); which will move the image to a more permanent location.

With Laravels Filesystem / Cloud Storage https://laravel.com/docs/5.2/filesystem

I suppose I can move the file to cloud storage using that. It would still be stored temporarily in the /tmp folder on local machine for a very short time though.

Is it possible to have the image file be originally uploaded to cloud server instead of the /tmp location on local server?

Or Is my only solution to do this client side with javascript?

0 likes
4 replies
schir1964's avatar

Is it possible to have the image file be originally uploaded to cloud server instead of the /tmp location on local server?

It is possible but it needs to be setup external from your own code. The Transloadit service is an example of an external service that your code can use to handle the uploading of files and storing them on cloud storage (such as Amazon's S3).

1 like
danWilcz's avatar

Yes I looked at Transloadit and I might use their Jquery library if I don't find a different solution.

I would like to do it with PHP but If I use their php lib I believe it is the same thing i.e. it would save image in /tmp and then I would have to move it to Transloadit and then from there into S3 or rackspace.

schir1964's avatar

I would like to do it with PHP but If I use their php lib I believe it is the same thing i.e. it would save image in /tmp and then I would have to move it to Transloadit and then from there into S3 or rackspace.

Actually, it doesn't. I've implemented this service for a project and the files are never stored on your server (even temporarily). What happens is the jQuery code connects to thier servers via an API and the file uploads onto thier servers. Once that is done the jQuery then updates the form with the file's reference information from transloadit and then submits the form on your website. If you want the direct link to where this is explained in their documentation I can provide it if needed.

1 like

Please or to participate in this conversation.