uploadify does not upload

2
<script type="text/javascript" charset="utf-8">
    $(function() {

        $('.startupload').click(function(event) {

            console.log('teste');

            $('#file_upload').uploadify({
                'uploader'     : '../_SWF/uploadify.swf',
                'script'       : '../uploadify.php',
                'cancelImg'    : '../_IMAGES/cancel.png',
                'folder'       : '<?php echo $vgcoreMidia."/galeriadeimagens/".$_GET["id"]."/gal"; ?>',
                'multi'        : true,
                'auto'         : false,
                'fileDataName' : 'Filedata',
                'onInit'       : function(event){
                    // console.log(event);
                },
                'onComplete'   : function(event, ID, fileObj, response, data) {
                    $.ajax({
                        type: "POST",
                        url: "propUpGalleries.php",
                        data: "imagename="+fileObj.name+"&id=<?php echo $_GET['id'] ?>",
                        success: function(msg){
                            console.log(data);
                        }
                    });
                },
                'onError' : function(event,data) {
                    // console.log(event);
                    // console.log(data);
                },
                'onAllComplete' : function(event,data) {
                    window.opener.location.reload();
                }
        });

        });

    });
</script>


<a href="javascript:$('#file_upload').uploadifyUpload()" class="startupload">Iniciar upload de imagens</a>

Returns the following error in the console:

jquery.uploadify.v2.1.4.js:282 Uncaught TypeError: document.getElementById(...).startFileUpload is not a function

On line:

    uploadifyUpload:function(ID,checkComplete) {
        jQuery(this).each(function() {
            if (!checkComplete) checkComplete = false;
            document.getElementById(jQuery(this).attr('id') + 'Uploader').startFileUpload(ID, checkComplete);
        });
    },
    
asked by anonymous 12.06.2015 / 20:31

1 answer

0

I've never used uploadify, but if it's a jQuery plugin as it seems to be, the line

document.getElementById(jQuery(this).attr('id') + 'Uploader').startFileUpload(ID, checkComplete);

It probably needs to be

jQuery(document.getElementById(jQuery(this).attr('id') + 'Uploader')).startFileUpload(ID, checkComplete);

or better

jQuery(document.getElementById(this.id + 'Uploader')).startFileUpload(ID, checkComplete);
    
13.06.2015 / 01:16