jquery - Uploadify Error in IE8 -
i can't uploadify (jquery plugin) work in ie8, works fine in other browsers.
when go upload file i'm getting error:
object doesn't support property or method
and it's on line in uploadify.js:
document.getelementbyid(jquery(this).attr('id') + 'uploader').startfileupload(id, false);
i can't figure out.
the javascript looks this:
<script type="text/javascript"> $(document).ready(function() { var scriptdata; $.get('/lib/upload_params.php', {'key': "files/<?=random?>/"}, function(data) { scriptdata = { 'awsaccesskeyid': data.awsaccesskeyid, 'key': encodeuricomponent(data.key), 'acl': "private", 'policy': encodeuricomponent(data.policy), 'signature': encodeuricomponent(encodeuricomponent(data.signature)), 'success_action_status': "201", 'folder':'', 'filename':'' }; // $('#file').uploadifysettings('scriptdata',scriptdata); start_uploadify(); }, "json" ); function start_uploadify() { $('#file').uploadify({ 'uploader' : 'http://domain.com/lib/uploadify/uploadify.swf', 'script' : 'http://cdn.domain.com', 'multi' : false, 'buttonimg' : 'http://domain.com/images/select_button.png', 'rollover' : true, 'width' : '131', 'height' : '40', 'sizelimit' : '1073741824', 'auto' : false, 'method' : 'post', 'scriptdata' : scriptdata, 'scriptaccess' : 'always', 'wmode' : 'transparent', onselect : function(event, queueid, fileobj) { $('#send_options').show().addclass('on'); $('#fileuploader').css('visibility', 'hidden'); $('#filequeue').css({'margin-top' : '-40px', 'visibility' : 'visible'}); }, oncomplete : function(event, queueid, fileobj, response, data) { //alert(fileobj.name); $('#upload_progess').html("<strong>upload complete</strong><br />we processing file..."); $('#fn').val(fileobj.name); $('#fs').val(fileobj.size); $('#form_1').submit(); }, 'onerror' : function(e, queueid, fileobj, errorobj){ //alert( dump(scriptdata) ); if(errorobj.info == 201){ //$('#file'+queueid).remove(); } else { alert(errorobj.type+' error:'+errorobj.info+'. sorry! (try again later)'); } }, 'folder' : '', 'filedataname' : 'file' }); } $('#send').live('click', function() { $('#file').uploadifyupload(); $('#send_options').hide(); $('#upload_progress').show(); }); $('#change_file').live('click', function() { $x = $('#send_options'); $y = $('#fileuploader'); $z = $('#filequeue'); if ($x.hasclass('on')) { $x.removeclass('on').hide(); $y.css('visibility', 'visible'); $z.css('visibility', 'hidden'); } else { $x.addclass('on'); } }); $('#method_2').delegate('', 'click', function() { $('.wrap_to').show(); }); $('#method_1').delegate('', 'click', function() { $('.wrap_to').hide(); });
});
not sure if you, encountered strange ie8 bug might related. if have function called "change_file" , have link <a onclick="change_file()">
, inside form contains <input name="change_file">
"object doesn't support property or method" error that's oh-so unhelpful.
hmm, did little more digging this, appears it's not "change_file" doesn't like, it's overlap in js function name & input names. makes little more sense actually, when it's trying find out "change_file" must looking @ form elements first, , finds form element, can't figure out why you're trying treat function.
so, maybe have input named "jquery"? (it might "jquery(this).attr('id')". tried 1 named "document", finds normal document fine.)
Comments
Post a Comment