开发者

Multiple file uploader with previews

开发者 https://www.devze.com 2023-01-01 12:29 出处:网络
I\'m trying to find something that will let users upload multiple files to a website. The requirements are that it let them easily select multiple files (preferably with something like check boxes) an

I'm trying to find something that will let users upload multiple files to a website. The requirements are that it let them easily select multiple files (preferably with something like check boxes) and that it displays a preview of the images they select.

I'd prefer to only use Javascript or Flash if possible, but Java is also an option (this needs to work on platforms where Silverlight isn't available).

So far all I've been able to find are things that use the native file selector (which doesn't show previews on Windows, and makes it unclear that you can select multiple by holding ctrl).

I'm not sure if the preview requirement is even possible, but it's the most important.开发者_如何学C


This is a firefox solution: It uses the FileReader javascript object to load, display and upload images.

http://hacks.mozilla.org/2011/01/how-to-develop-a-html5-image-uploader/

It still doesnt show previews in the FileSelection dialog but at least allows you to preview the images before uploading.

And here is a ready made java applet solution: http://jumploader.com/doc_overview.html


To upload multiple files I use RichFaces rich:fileUpload component.

Concerning the preview, I've got the similar problem and the best I found after couple of days of googling is following.

Alfresco has the same problem and resolved it with :

  • An open office which runs in server mode (socket) and all the office documents are sent by alfresco to open office in order to convert them in PDF
  • Those PDF are converted to .swf viewer thanks to SWFTOOLS
  • This .swf is integrated in the HTML
  • For images, it uses ImageMagick to create small version of the file I suppose

Personnaly, I will try to implement it this way :

  • Converting office documents to PDF thanks to open office in socket mode
  • Transform the first page of the PDF into a PNG thanks to JPedal library
  • Diplay that PNG to the end user
  • For images I would perhaps use ImageMagick too ... but for now, I'm using Seam Image.scaleToFit API


I am assuming 2 things here:

1) Some kind of client/enduser will be doing the file upload

2) You get some kind of say on what the client installs on their computer to help make this happen.

If this is the case, my first suggestion would be:

Give them FTP or SFTP client software to upload files. The php page you make can have a link to Filezilla, along with instructions on how to use it. ftp and sftp are THE protocols to use for transferring files. HTTP is just not designed(well) for it, nor are browsers.

Once the user has the (S)FTP client software installed, you can give them URL's to upload files to that are specific to their user account, and you can have a backend script process and load/move files that they upload. It's pretty easy to create a local temporary directory using a server side script, have the client upload files via ftp, then go back to the web browser and click a button that says "Done uploading, please process my stuff".

The browser can even give back confirmations on everything that gets uploaded/processed.

0

精彩评论

暂无评论...
验证码 换一张
取 消