开发者

Preview Image while file uploading using "UPLOADIFY"

开发者 https://www.devze.com 2023-04-08 20:53 出处:网络
I am uploading the file using the script from \"UPLOADIFY\" site, The image is uploading successfully, But Now I want to preview the image on my UI Page, I have written some script (Converted image in

I am uploading the file using the script from "UPLOADIFY" site, The image is uploading successfully, But Now I want to preview the image on my UI Page, I have written some script (Converted image into Base 64 Encrypted code) to preview the image. Both the functionalities are working fine individually, But I am unable to execute both functionalities one by one. Here is the code I have used Please help Me.

$(document).ready(function() {
  $('#file_upload').uploadify({
    'uploader'  : '/js/uploadify/uploadify.swf',
    'script'    : 'index.php',
    'fileExt'     : '*.jpeg;*.gif;*.png',
    'fileDesc'    : 'Image Files',
    '开发者_运维知识库buttonText'  : 'Select File',
    'sizeLimit'   : 102400,
    'onSelect'    : function() {preview(this);}
  });
});


I'm assuming you would like to preview the image onSelect... That is not possible due to security measures in modern browsers which prevent local (user-local) images from being displayed. This means that in order to preview the image you must first upload it (for example, set the upload mode to 'auto' and then onComplete add the temporary image to a div) and then the user would have a button of some sort to 'confirm' that the temporary image is indeed the desired one. That button would then move the temporary image to a definitive folder and add it to the database.

Sorry for not adding code, but I think you can easily manage to do it on your own. There are some great tutorials around too.

Cheers

0

精彩评论

暂无评论...
验证码 换一张
取 消