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?

2
  • 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 Commented May 21, 2012 at 6:37
  • Here is a solution for IE9&IE10. Lower versions are still uncovered. stackoverflow.com/a/16788647 Commented Oct 3, 2013 at 23:34

2 Answers 2

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'
});
Sign up to request clarification or add additional context in comments.

Comments

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) {}
          }

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.