Search code examples
javascriptuploadifyimage-uploading

Change uploadify image after upload


I use uploadify to upload an image. The upload button is a camera image (camera.png), but when selecting an image, and when upload is successful, the upload button image is another image (success.png).

Here is the used javascript code:

$('#form-add-post-image').uploadify({
    'swf':         'uploadify/uploadify.swf',
    'uploader':    'uploadify/uploadify.php',
    'buttonImage': 'uploadify/camera.png',
    'width':       128,
    'height':      128,
    'onUploadSuccess': function(file, data, response){
        $(this).uploadify('settings', 'buttonImage', 'uploadify/success.png');
    }
});

But, this doesn't work, and the console gives this error message: Uncaught ReferenceError: settingValue is not defined.

Any idea?

And what Uncaught ReferenceError: settingValue is not defined means?

Thanks in advance


Solution

  • I am using jquery.uploadify.v2.1.4.min.js I wanted also to change the upload image after the image is uploaded, a simple solution that I found was add the hideButton property to my uploadify settings

    'hideButton': 'true',

    and you wont have to load the browse image from uploadify simply load it from your css

        #your_uploadify_id{
        background: url(browse.png) no-repeat;
    }
    

    then in onComplete load the new image to your css:

    'onComplete'  : function(){
    $("#browes_pictureUploader").css({'background-image':'url(change_picture.png)'});
    }