Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best Practice for Uploading Many (2000+) Images to A Server

I have a general question about this.

When you have a gallery, sometimes people need to upload 1000's of images at once. Most likely, it would be done through a .zip file. What is the best way to go about uploading this sort of thing to a server. Many times, server have timeouts etc. that need to be accounted for. I am wondering what kinds of things should I be looking out for and what is the best way to handle a large amount of images being uploaded.

I'm guessing that you would allow a user to upload a zip file (assuming the timeout does not effect you), and this zip file is uploaded to a specific directory, lets assume in this case a directory is created for each user in the system. You would then unzip the directory on the server and scan the user's folder for any directories containing .jpg or .png or .gif files (etc.) and then import them into a table accordingly. I'm guessing labeled by folder name.

What kind of server side troubles could I run into?

I'm aware that there may be many issues. Even general ideas would be could so I can then research further. Thanks!

Also, I would be programming in Ruby on Rails but I think this question applies accross any language.

like image 520
jim Avatar asked Jun 02 '10 03:06

jim


People also ask

How do I upload an image to a web server?

Upload using an FTP program or image hosting service. Use your web server's hyperlink function to link your URL. Alternatively, link to the image using the page's HTML code. You must be able to identify the image's permanent location to be able to serve it to your visitors.

How do you handle pictures?

Optimizing images on your website and app include choosing the right type of image format, using smaller kb images by reducing the size, image compression, and using responsive images as per different platforms. Always select the best image format (JPEG, PNG, or GIF) and do proper image resizing as per the platforms.


1 Answers

There's no reason why you couldn't handle this kind of thing with a web application. There's a couple of excellent components that would be useful for this:

  1. Uploadify (based on jquery/flash)
  2. plupload (from moxiecode, the tinymce people)

The reason they're useful is that in the first instance, it uses a flash component to handle uploads, so you can select groups of files from the file browser window (assuming no one is going to individually select thousands of images..!), and with plupload, drag and drop is supported too along with more platforms.

Once you've got your interface working, the server side stuff just needs to be able to handle individual uploads, associating them with some kind of user account, and from there it should be pretty straightforward.

With regards to server side issues, that's really a big question, depending on how many people will be using the application at the same time, size of images, any processing that takes place after. Remember, the files are kept in a temporary location while the script is processing them, and either deleted upon completion or copied to a final storage location by your script, so space/memory overheads/timeouts could be an issue.

If the images are massive in size, say raw or tif, then this kind of thing could still work with chunked uploads, but implementing some kind of FTP upload might be easier. Its a bit of a vague question, but should be plenty here to get you going ;)

like image 82
dmp Avatar answered Sep 28 '22 21:09

dmp