1. Add in Head
<Script src = "../lib/js/ajaxfileupload. js" type = "text/javascript"> </script>
<Script src = "../lib/js/ligerui. expand. js" type = "text/javascript"> </script>
Ii. Div code in Html
<Div id = "AppendBill_Div" style = "display: none;"> <% -- upload-ticket -- %>
<Table style = "height: 100%; width: 100%">
<Tr style = "height: 40px">
<Td style = "width: 20%">
Icon:
</Td>
<Td> <input type = "file" style = "width: 200px" id = "fileupload" name = "fileupload"/>
</Td>
</Tr>
</Table>
</Div>
3. In Js, what is written is the key part. LigerUI friends will be displayed.-You know
1. Add the item "storage address field" to the grid]
{Display: "scanned copy", name: "AppendBillPath", width: 120, type: "text", align: "left "}
2. You can add a Form item [Save address and pop-up selection box]
{Name: "AppendBillPath1", type: "hidden"}, // -- upload-[5 ]--
{Display: "scanned copy", name: "AppendBillPath", comboboxName: "AppendBillPath2", newline: true, labelWidth: 100, width: 150, space: 30, type: "select", options :{}// -- upload-[6 ]--
$. Ligerui. get ("AppendBillPath2"). set ('onbeforeopen', f_selectAppendBillPath_1) // [scanned copy] // -- upload-[7 ]--
3. Events
// # Region ========================================== === [scan upload window] // -- upload-[8 ]--
Var AppendBillPathDetail = null;
Function f_selectAppendBillPath_1 (){
Var imageurl = $ ("# AppendBill"). val ();
Var AppendBill_Id = $ ("# AppendBill"). val (); // Ticket No.
If (imageurl. length = 0 ){
LG. showError ("You have not entered the order number. Please enter the order number! ");
Return;
}
If (AppendBillPathDetail ){
AppendBillPathDetail. show ();
}
Else {
AppendBillPathDetail = $. ligerDialog. open ({
Target: $ ("# AppendBill_Div"), title: 'add icons ',
Width: 360, height: 170, top: 170, left: 280, // window size displayed
Buttons :[
{Text: 'upload', onclick: function () {AppendBillPath_save ();}},
{Text: 'cancel', 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 ("Upload jpg, jpep, png, gif, and bmp image files ");
Return;
}
Var imageurl = $ ("# AppendBill"). val (); // extend
Alert (imageurl );
$. AjaxFileUpload ({
Url: "../handle/ImageUpload. aspx? Imageurl = "+ imageurl, // -- upload-[9] -- aspx File
Secureuri: false,
FileElementId: "fileupload", // Input file id
DataType: "text ",
Success: function (data, status)
{
// ----------------- // Save path
// $ ("# AppendBillPath2"). val (Data );
LG. tip (data );
F_reload ();
},
Error: function (data, status, e ){
LG. showError (data );
}
});
}
// # Endregion
4. backend cs: Write a key sentence. You can return parameters and the front-end prompts
String url = Server. MapPath ("/Image/" + gfilename + filenameext); // perform the upload operation