1

I am trying to uplaod images to folder an then trying to show them as soon as they upload an I am able to display the image and not able to display it's URL simultaneously.

But inividually I am able to display one another.

Any help will be greatly appreciated

Thanks in advance

Here is my java script code:

<script type="text/javascript">
$(window).load(
function () {
    $("#Inputfile").fileUpload({
        'uploader': 'scripts/uploader.swf',
        'cancelImg': 'images/cancel.png',
        'buttonText': 'Browse Files',
        'script': 'UploadVB.ashx',
        'folder': 'uploads',
        'fileDesc': 'Image Files',
        'fileExt': '*.jpg;*.jpeg;*.gif;*.png',
        'queueSizeLimit': 3,
        'simUploadLimit': 2,
        'sizeLimit'   : 4000000,
        'multi': true,
        'auto': false,
        'onQueueFull'    : function (event,queueSizeLimit) {
         alert("I'm stuffed, please don't put anymore files in me!");
         return false;
         },
     'onComplete': function (event, queueID, fileObj, response, data) {
         $("#showimage").append("<img  src='" + response + "' height='500px' width='500px' />");
         $("#showimage").html(document.write('http://localhost:XXXX' + fileObj.filePath));
         },      

        'onError' : function (event,ID,fileObj,errorObj) {
                  alert(errorObj.type + ' Error: ' + errorObj.info);
}

});
}
);

1 Answer 1

2

.html() is replacing the contents of $("#showimage") with the html, which is wiping out the image. Try including your image tag in html:

$("#showimage").html('<img src="' + response + '" height="500" width="500" /><br />http://localhost:XXXX' + fileObj.filePath);
Sign up to request clarification or add additional context in comments.

1 Comment

Thank you so much it worked perfect and can I give it as a hyperlink and one more thing if you have any idea regarding uploadify how to link with lightbox effect can you share some ideas.

Your Answer

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