News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Question about using multiple servers for file uploading

Started by Jade Elizabeth, November 27, 2014, 04:42:02 AM

Previous topic - Next topic

Jade Elizabeth

So I am learning php and slim/eloquent/laravel at school and I was wondering....

If I build a website on Server A, and it has places for people to upload documents and images, etc, can I make it upload them to server B? Server A and B are in different countries.

Would this be possible if using a framework such as symphony or the one I'm learning at school? Would it be secure?

If it is possible can someone possibly explain to me how and how I would be able to gather that data? I assume I would store the name in the database and be able to get it's location that way :).


'Scuse me if this is a noob question. Completely unrelated to SMF by the way.
Once proud Documentation Writer and Help Squad Leader | Check out my new adult coloring career: Color With Jade/Patreon.

Arantor

Possible, sure, just a total PITA to do. You still have to send it to server A, then have server A send to server B.

Frameworks might come with components for doing this with Amazon S3, but rolling this yourself is hard work and generally totally unnecessary outside of specific circumstances.

Dragooon

Ohhh we used to do this in my previous job, basically we had our own servers but used AWS S3 for serving large files as well as our static files such as CSS and images, AWS has an API you can use as well as PHP SDK which we used for uploading files from our server (you can also do direct upload from client side but we needed the files on server first to process a few things) and store the file's name and information on a local database to fetch it later whenever required.

The basic principles are same even if you want to have both the servers yourself, server A is your primary server and it'll store the file's meta data (name, size, type etc) and send it to server B (via HTTP or FTP depending upon your preference/environment, check out cURL for sending via HTTP). Later you can use your local database to request it from server B. For this you should have some security measures to ensure server B only accepts from server A (AWS uses hash secrets from what I remember, that's probably the best way).

Jade Elizabeth

I was considering using cURL to grab the form for uploading, and making the upload itself on server B....would that work? My understanding of cURL is extremely basic, I'm actually coding in it right now (which is not as amazing as it sounds, it's my first day ha ha).

I thought perhaps an iframe but that just sounds messy so I wanted to do it through code. I know you can split websites up across multiple servers but I think they have to be somewhat connected, if not in the same room/centre.
Once proud Documentation Writer and Help Squad Leader | Check out my new adult coloring career: Color With Jade/Patreon.

Advertisement: