0

I have often wonder how Facebook is able to handle uploading multiple files on the server when I am uploading my pictures.

I am quite not sure how it is being implemented. As I know, you could only send one file to the server through http one at a time unless you are going to make use of Applets.

Does anybody know how Facebook implements this? Is this Flash or an applet or something?

halfer
  • 19,824
  • 17
  • 99
  • 186
Mark Estrada
  • 9,013
  • 37
  • 119
  • 186

1 Answers1

1

There's nothing special that you need to do on your web page - multiple <input type="file"> elements in the same <form> will upload multiple files at once.

The tricky part is handling all those files on the server. Take a look at a library such as Apache Commons FileUpload

Edit

You might want to take a look at this thread - people have suggested quite a few readily available components that you can use (note that these are for the client-side i.e. in the browser. You still need to handle the uploaded files on the server using something like the FileUpload library I mentioned before)

Community
  • 1
  • 1
no.good.at.coding
  • 20,221
  • 2
  • 60
  • 51
  • Hi Sir, I already have Apache Commons File Upload setup at the server and that I have done using multiple input of file type. Facebook allows you to browse your directory and then select all pictures at once. This is the functionality that I am looking for. By the way your link is very interesting. – Mark Estrada Feb 21 '11 at 01:01
  • Aah, I see - you want a single file select element but multiple files. As far as I know, you can't do that with just HTML/JS, you need something like Java, Flash or similar, something that will let you access the client filesystem and use a custom file select dialog. I checked and Facebook has a Flash uploader, if I remember correctly, it was a Java applet before. And if you see their 'simple uploader', it's a form with multiple file input elements. So I guess the thread I linked to is probably a good place to start for a plugin that will help you do this. – no.good.at.coding Feb 21 '11 at 04:43