2

I am having a HTML file input in order to upload multiple files.

 <input type="file" id="file_uploader" name="files[]" multiple="multiple" accept=".png,.jpg,.swf,.gif">

i used this answer to show preview of the image files (jpg,png,gif) and is working like a charm. But when trying preview a swf file I face some difficulties.. I use the embed tag to preview the swf file with no luck. No error, is showing and I also can't see the swf file. The code I use :

HTML

<embed id="flash">

Jquery

function local_preview() {
        $("#file_uploader").change(function() {
            readURL(this);
        })
    }

    function readURL(input) {
        if (input.files && input.files[0]) {
            var reader = new FileReader();
            reader.onload = function(e) {
                $('#flash').attr('src',e.target.result);
                $('#flash').attr('type',"application/vnd.adobe.flash-movie");
            }
            reader.readAsDataURL(input.files[0]);
        }
    }

What is the problem in the solution I try?

Community
  • 1
  • 1
cs04iz1
  • 1,449
  • 14
  • 30

0 Answers0