dongzhang0243
2012-07-02 23:13
浏览 51

用于图像上传的PHP / JQuery输入框

I am currently working with multiple php image uploading but using this SITE I am unable to figure out, if I can increase from 3 to 4 inputs for file upload? i have looked through all the files but havent found anything relevant. Any one used this SITE example before can help me?

Jquery

(function($) {

$(document).ready(function() {

    // it must be checked if there are div.imageForms because the
    // uploaderPreviewer javascript may be not included and produce an error
    if ($('div.imageForms').length) {

        $('div.imageForms').append($.uploaderPreviewer.createImageForms());

        // the images are populated if the admin form is to edit, and not
        // to insert
        if ($('div.imageForms[images]').length) {
            var imageFilenames = $('div.imageForms[images]').attr('images').split(',');
            $.uploaderPreviewer.populateImages(imageFilenames);
            $('div.imageForms[images]').removeAttr('images');
        }
    }

    $('#buttonSave').click(function() {
        var itemId = $(this).attr('itemId');
        if (itemId) {
            $.itemForm.update(itemId);
        }
        else {
            $.itemForm.insert();
        }
    });

});

})(jQuery);

</script>

HTML

<html>

<div class="imageForms"></div>

    <div class="buttonSave">
        <button id="buttonSave">Upload</button>
    </div>

</div>

</html>

图片转代码服务由CSDN问答提供 功能建议

我目前正在处理多个php图片上传,但使用此 SITE 我无法弄清楚,如果我可以增加3到4个文件上传输入? 我查看了所有文件但没有发现任何相关内容。 任何人在使用此 SITE 示例之前可以帮助我吗?

Jquery

 (function($){
 
 $ n(document).ready(function(){
 
 / n /  /必须检查是否存在div.imageForms,因为
 // uploaderPreviewer javascript可能未被包含并产生错误
 if($('div.imageForms')。length){
 
 $('  div.imageForms')。append($。uploaderPreviewer.createImageForms()); 
 
 //如果要编辑管理表单,则填充图像,而不是
 //插入
 if($('  div.imageForms [images]')。length){
 var imageFilenames = $('div.imageForms [images]')。attr('images')。split(','); 
 $ .uploaderPreviewer.populateImages  (imageFilenames); 
 $('div.imageForms [images]')。removeAttr('images'); 
} 
} 
 
 $('#buttonSave')。click(function(){\  n var itemId = $(this).attr('itemId'); 
 if(itemId){
  $ .itemForm.update(itemId); 
} 
 else {
 $ .itemForm.insert(); 
} 
}); 
 
}); 
 
})(jQuery)  ; 
 
&LT; /脚本&GT; 
   
 
 

<强> HTML

 <代码>&LT;  html&gt; 
 
&lt; div class =“imageForms”&gt;&lt; / div&gt; 
 
&lt; div class =“buttonSave”&gt; 
&lt; button id =“buttonSave”&gt;上传&lt; / button&gt  ; 
&lt; / div&gt; 
 
&lt; / div&gt; 
 
&lt; / html&gt; 
   
 
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dongxing4643 2012-07-02 23:27
    已采纳

    Once the DOM has loaded, you can manipulate the $.uploaderPreviewer object options. All you have to do is:

    $.uploaderPreviewer.formsCount = 4;
    

    See the revised code.

    打赏 评论

相关推荐 更多相似问题