解析Jquery的LigerUI如何實(shí)現(xiàn)文件上傳
<script src="../lib/js/ajaxfileupload.js" type="text/javascript"></script>
<script src="../lib/js/ligerui.expand.js" type="text/javascript"></script>
二、Html中的Div代碼
<div id="AppendBill_Div" style="display:none;"> <%-- 上傳 - 單 --%>
<table style="height:100%;width:100%">
<tr style="height:40px">
<td style="width:20%">
圖標(biāo):
</td>
<td><input type="file" style="width:200px" id="fileupload" name="fileupload"/>
</td>
</tr>
</table>
</div>
三、Js中-寫(xiě)的是關(guān)鍵部分,會(huì)LigerUI的朋友-你懂得
1、grid中添加項(xiàng)【存地址字段】
{ display: "掃描件", name: "AppendBillPath", width: 120, type: "text", align: "left" }
2、Form可添加項(xiàng)【存地址和彈出選擇框】
{ name: "AppendBillPath1", type: "hidden" }, // --上傳-【5】--
{ display: "掃描件", name: "AppendBillPath", comboboxName: "AppendBillPath2", newline: true, labelWidth: 100, width: 150, space: 30, type: "select", options: {}} // --上傳-【6】--
$.ligerui.get("AppendBillPath2").set('onBeforeOpen', f_selectAppendBillPath_1) // 【掃描件】 // --上傳-【7】--
3、事件
// #region ======================================= 【上傳掃描件窗口】 // --上傳-【8】--
var AppendBillPathDetail = null;
function f_selectAppendBillPath_1() {
var imageurl = $("#AppendBill").val();
var AppendBill_Id = $("#AppendBill").val(); // 單號(hào)
if (imageurl.length == 0) {
LG.showError("您沒(méi)有輸入單號(hào),請(qǐng)輸入隨單號(hào)!");
return;
}
if (AppendBillPathDetail) {
AppendBillPathDetail.show();
}
else {
AppendBillPathDetail = $.ligerDialog.open({
target: $("#AppendBill_Div"), title: '添加圖標(biāo)',
width: 360, height: 170, top: 170, left: 280, // 彈出窗口大小
buttons: [
{ text: '上傳', onclick: function () { AppendBillPath_save(); } },
{ text: '取消', onclick: function () { AppendBillPathDetail.hide(); } }
]
});
}
}
function AppendBillPath_save()
{
var imgurl = $("#fileupload").val();
// var filehelpcode = $("#filehelpcode").val();
var extend = imgurl.substring(imgurl.lastIndexOf("."), imgurl.length);
extend = extend.toLowerCase();
if (extend == ".jpg" || extend == ".jpeg" || extend == ".png" || extend == ".gif" || extend == ".bmp")
{
}
else
{
LG.showError("請(qǐng)上傳jpg,jpep,png,gif,bmp格式的圖片文件");
return;
}
var imageurl = $("#AppendBill").val(); // extend
alert(imageurl);
$.ajaxFileUpload({
url: "../handle/ImageUpload.aspx?imageurl=" + imageurl, // --上傳-【9】-- aspx文件
secureuri: false,
fileElementId: "fileupload", //Input file id
dataType: "text",
success: function (data, status)
{
// ----------------- // 保存路徑
// $("#AppendBillPath2").val(Data);
LG.tip(data);
f_reload();
},
error: function (data, status, e) {
LG.showError(data);
}
});
}
// #endregion
四、后臺(tái)cs,寫(xiě)一句關(guān)鍵的,可以返回參數(shù),前臺(tái)提示
string url = Server.MapPath("/Image/" + gfilename + filenameext); // 執(zhí)行上傳操作
- jQuery Ajax文件上傳(php)
- 分享20多個(gè)很棒的jQuery 文件上傳插件或教程
- 使用jQuery Uploader顯示文件上傳進(jìn)度
- Jquery Uploadify多文件上傳帶進(jìn)度條且傳遞自己的參數(shù)
- js jquery分別實(shí)現(xiàn)動(dòng)態(tài)的文件上傳操作按鈕的添加和刪除
- jQuery文件上傳插件Uploadify使用指南
- php+jQuery.uploadify實(shí)現(xiàn)文件上傳教程
- jQuery實(shí)現(xiàn)簡(jiǎn)單的文件上傳進(jìn)度條效果
- jquery插件ajaxupload實(shí)現(xiàn)文件上傳操作
- jQuery插件實(shí)現(xiàn)文件上傳功能(支持拖拽)
相關(guān)文章
JQuery實(shí)現(xiàn)簡(jiǎn)單的圖片滑動(dòng)切換特效
基于jQuery的一款圖片展示特效代碼,鼠標(biāo)移到圖片上方懸停時(shí)會(huì)自動(dòng)切換成文字簡(jiǎn)單顯示,適合做圖片集展示,推薦給大家。2015-11-11jquery判斷小數(shù)點(diǎn)兩位和自動(dòng)刪除小數(shù)兩位后的數(shù)字
這篇文章主要介紹了jquery判斷小數(shù)點(diǎn)兩位和自動(dòng)刪除小數(shù)兩位后的數(shù)字,需要的朋友可以參考下2014-03-03基于jquery的9行js輕松實(shí)現(xiàn)tab控件示例
tab控件的實(shí)現(xiàn)方法有很多,在本文為大家詳細(xì)介紹下如何通過(guò)9行js實(shí)現(xiàn)簡(jiǎn)單的tab控件,感興趣的朋友不要錯(cuò)過(guò)2013-10-10jquery獲取特定name所有選中的checkbox,支持IE9標(biāo)準(zhǔn)模式
jquery獲取特定name所有選中的checkbox,支持IE9標(biāo)準(zhǔn)模式,需要的朋友可以參考一下2013-03-03JQUERY 設(shè)置SELECT選中項(xiàng)代碼
本篇文章主要是對(duì)JQUERY 設(shè)置SELECT選中項(xiàng)的代碼進(jìn)行了介紹,需要的朋友可以過(guò)來(lái)參考下,希望對(duì)大家有所幫助2014-02-02addEventListener—jQuery的事件監(jiān)聽(tīng)方法
在Javascript中,事件監(jiān)聽(tīng)是非常重要的,通過(guò)事件監(jiān)聽(tīng),我們可以在用戶(hù)執(zhí)行某些操作時(shí)觸發(fā)相應(yīng)的處理程序。最初,Javascript監(jiān)聽(tīng)事件的方式是addEvent。addEvent()比較麻煩,所以jQuery為我們提供了一個(gè)更為便捷的事件監(jiān)聽(tīng)方法:addEventListener。2023-06-06jquery實(shí)現(xiàn)列表上下移動(dòng)功能
這篇文章主要為大家詳細(xì)介紹了jquery 實(shí)現(xiàn)列表上移、下移功能的相關(guān)資料,感興趣的小伙伴們可以參考一下2016-02-02Jquery的Tabs內(nèi)容輪換效果實(shí)現(xiàn)代碼,幾行搞定
本篇文章主要是對(duì)Jquery的Tabs內(nèi)容輪換效果的實(shí)現(xiàn)代碼進(jìn)行了介紹。幾行代碼輕松搞定2014-02-02