0

I have a form to upload a image with jQuery form. everting is ok, but when I want trigger file input type click after select a file, in IE ONLY returns this error: access is denied

$('#imageform #photoimg').trigger('click'); or setTimeout(function(){$('#imageform #photoimg').trigger('click')},1000);
$('#photoimg').live('change',function()
{
    //$("#preview").html('');
    //$("#preview").html('<img src="loader.gif" alt="Uploading...."/>');
    $("#imageform").ajaxForm(
        success: function(out) {
            var imageur = out;
            // do tiny work with out;
        }
    }).submit();
});

Where is the problem and how I can resolve it?

Mihai Iorga
  • 36,863
  • 13
  • 100
  • 102
Yuseferi
  • 5,610
  • 10
  • 54
  • 83
  • at last i find out this a "dear" IE feature,(they this this work can vuluntariable and block it, what a safe and secure "dear" IE . for do this work u must do trickly method – Yuseferi May 21 '12 at 06:37
  • Here is a solution for IE9&IE10. Lower versions are still uncovered. http://stackoverflow.com/a/16788647 – Kerem Demirer Oct 03 '13 at 23:34

2 Answers2

1

By default IE does not let you trigger file element change.

If you want you this feature, can use ajaxuploader or fileuploader:

var uploader = new qq.FileUploader({
    // pass the dom node (ex. $(selector)[0] for jQuery users)
    element: document.getElementById('file-uploader'),
    // path to server-side upload script
    action: '/server/upload'
});
Littm
  • 4,895
  • 4
  • 28
  • 36
0

I commented these lines in j query.form.js then every thing works fine for me. Don't ask me the reason even i don't have the solution for that but it works for sure.

            if (io.contentWindow.document.execCommand) {
              try { // #214
                   io.contentWindow.document.execCommand('Stop');
             } catch(ignore) {}
          }
cherry
  • 55
  • 1