Facebook-style multiple image upload - file-upload

Facebook has the ability to select multiple images in the file browser in its upload feature.
Can anyone explain how this is achieved?
I'd like to do something similar in jquery without the use of a flash widget.

The HTML5 File API enables you to do it natively. Basically you add the multiple="multiple" attribute to the file upload control:
<input multiple="multiple" type="file" ... />
Disadvantage: Only runs in modern browsers like Firefox, Chrome, Safari. IE, even version 9 does not support this multiple upload.
Otherwise, you have to rely on some Flash or Java upload component.
(Edit: Changed to multiple="multiple", thanks to Ms2ger)

The best and easiest jQuery-based multiupload scripts (IMHO):
http://www.uploadify.com/
http://www.uploadify.com/demos/
free and open source

Instructions on how to include jQuery File Upload with Rails setup https://github.com/blueimp/jQuery-File-Upload/wiki/Rails-setup-for-V5/35cca0e5e21b5c8fb29b89e9675314907ac1a464
(note: this question was originally answered 3 years ago, the above link may have inaccurate instructions for recent versions of the referred gems/libraries, but may be easy for someone to follow and fix whatever have changed).

Related

How to open a PDF file that is present with API response in karate?

We have an API with just retrieves PDF from a Server. So when the API is hit, we get this as response.
In SOAP UI, there will be an attachment tab from which we can open the PDF file.
Is there a way to do this in Karate.?
We are trying to move towards Karate
Being able to preview a PDF is for manual testing and Karate is a test-automation tool. So it is not supported and my suggestion is that you don't worry about this and move on. In my opinion this is not a mandatory requirement for you.
What is important is to be able to do a comparison. If you are doing an exact binary match, this is already possible, refer: https://stackoverflow.com/a/55147777/143475
You may be able to embed a PDF into an HTML report, refer: https://github.com/karatelabs/karate/tree/v1.2.1.RC1/karate-demo/src/test/java/demo/embed
Finally if you really insist on "opening" the PDF somehow during a test, you can use the ability of Karate to call command-line programs. For example open foo.pdf works on a Mac. Refer this: https://stackoverflow.com/a/62911366/143475
EDIT: Karate has visual testing in version 1.3.0 onwards, perhaps you can give this a try: https://github.com/karatelabs/karate#compare-image

Upload Progress in Wicket for MultiFileUploadField

Wickets UploadProgressBar does only work for 'FileUploadField'. This is insufficient for my needs as I need to transfer multiple files which will be added by the User (Just like it can be done with 'MultipleUploadField').
So I'd like to implement an UploadProgressBar which also works for the MultipleUploadField but don't know what would be the best approach to do this. I recognized the classes UploadInfo and UploadStatusResource which might be useful here.
Does anyone have a suggestion what would be the best way to solve this problem?
Have a look at Uploadify at www.uploadify.com, which uses Flash to upload multiple files. You can integrate its Javascript callbacks nicely into Wicket, using Wicket's JS features.
It brings a nice progress bar for each single file upload.
Or you can wait for HTML 5.
Meanwhile you can also check for a better Javscript library for multiple file uploads and again integrate it in Wicket.

Speech to Text API (NON-MOBILE)

I'm trying to write a program that takes in audio from the user via microphone, and then converts what's being said to text for further manipulation.
I know google has such a thing, but it's for Android developers, and I'm trying to make something more like a chrome extension (chrome extension is what I had envisioned, but I'm open to alternatives).
I've looked at the Mac OSX NSSpeechRecognizer, but I need something more comprehensive since this requires you to specify a limited grammer ahead of time.
I can't expect, or predict what my users will say into the microphone (but I CAN assume it will be English).
Google have an unofficial API, which can be used as described in this post:
http://mikepultz.com/2011/03/accessing-google-speech-api-chrome-11/
If you're writing a chrome extension, you might be able to use a tag like:
<input type="text" x-webkit-speech />
which adds the microphone button and uses google's cloud speech-recognition to fill the text box with what the user says.

Multiple files upload chosen in the same browse file window (Ruby on Rails)

I've searched for "multiple files upload in ruby on rails" and the plugins that were suggested always displayed multiple <input type="file" ...> tags. I'm looking for something where I can choose multiple files in the same browse file window, like when uploading photos on facebook.
I've found this one, but it requires some under-the-hood coding to be used in RoR (it is ready for PHP).
My requirements are really basic: I only need to be able to upload files facebook-like. No visual effects needed, or progress bars or whatever. So maybe I'm thinking about implementing my own uploader, but I don't know where to start.
So if you got either 1) a suggestion of RoR plugin that might do what I just described or 2) tips on how to implement one myself, I'd be very glad to hear them.
I've heard good things about Plupload and, to a lesser extent, Uploadify. The former uses a variety of techniques transparently to try and achieve multi-file upload (using the HTML5 API if possible); the latter only supports Flash (though this is what many users will end up using).
Integrating these with Rails is just a matter of implementing the API they expect, which is fairly straightforward.
Here is a post by someone who has taken the effort of making sure CSRF protection and Flash session cookies even co-operate. http://planetrails.com/plupload-with-rails-3
I have not followed that particular guide myself, but it seems correct.
I've had good success with the jQuery File Upload Plugin. It uses both the HTML5 "multiple" attribute for file inputs and drag-and-drop uploading.
If you're using paperclip and jQuery, you can get it integrated in your app pretty quickly.

Embedding PDF documents into websites

I need to embed some PDF documents into a website. The last time I did this, I used a jQuery lightbox to popup an iFrame with the PDF document as the URL. The client's PDF viewer would then take care of the rest.
Apparently though, that was a bit buggy on some other peoples browsers. I guess it was due to the large PDF file sizes and the effort it took for their computers to fire up Adobe.
So I'm after ideas on how to go about this. How do you guys embed your PDF's into websites? Or do you just stick to adding a download link?
I often use scribd to solve this issue.
You have to upload your document (can be PDF, DOC or something else) to your scribd account and the service makes it possible to view this (pdf) document in a flash environment (perfectly embedabble with lightbox).
For this solution, a third party service (scribd) is required for your documents, but with their API it's possible to include all scribd functionality in your own website.
We have used Docuter
They let you embed and track
I've used Google Docs in Flash: http://trajctrl.tyblu.ca/?page_id=2
It's a bit buggy, but I find it works if you wiggle the image a bit - ie: zoom, click, etc. Download link is nearby just in case, too. Not exactly sure how it was done, as its a Wordpress plugin (Google Doc Embedder), but I imagine Google has an API somewhere.