Introducing Styles and JS files
<Linkhref= "Css/bootstrap.min.css"type= "Text/css"rel= "stylesheet"/> <Linkrel= "stylesheet"href= "Css/jquery.fileupload.css"> <Linkrel= "stylesheet"href= "Css/jquery.fileupload-ui.css"> <Scriptsrc= "Js/jquery.js"></Script> <Scriptsrc= "Js/jquery.ui.widget.js"></Script> <Scriptsrc= "Js/jquery.fileupload.js"></Script>
Html
<Body> <Divclass= "Row Fileupload-buttonbar"style= "padding-left:15px;"> <Divclass= "Thumbnail col-sm-6"> <imgID= "Weixin_show"style= "HEIGHT:180PX;MARGIN-TOP:10PX;MARGIN-BOTTOM:8PX;"src= "__public__/images/game/game_1.png"data-holder-rendered= "true"> <Divclass= "Progress progress-striped Active"role= "ProgressBar"Aria-valuemin= "Ten"Aria-valuemax= "+"Aria-valuenow= "0"> <DivID= "Weixin_progress"class= "Progress-bar progress-bar-success"style= "width:0%;"></Div> </Div> <Divclass= "caption"Align= "Center"> <spanID= "Weixin_upload"class= "btn btn-primary Fileinput-button"> <span>Upload</span> <inputtype= "File"ID= "Weixin_image"name= "Files"multiple> </span> <aID= "Weixin_cancle"href= "javascript:void (0)"class= "Btn btn-warning"role= "button"onclick= "Cancleupload (' Weixin ')"style= "Display:none">Delete</a> </Div> </Div> </Div> </Body>
Uploading Ajax:
<Scripttype= "Text/javascript">$ (function () {$ ("#weixin_image"). FileUpload ({url: ' Http://www.test007.com/ser/ap I/json/file/upload/batch ', sequentialuploads:true}). bind (' fileuploadprogress ', functio N (E, data) {//main progress bar modified var progress = parseint (Data.loaded/data.total * 100, 10); $ ("#weixin_progress"). CSS (' width ', progress + '% '); $ ("#weixin_progress"). HTML (progress + '% '); }). bind (' Fileuploaddone ', function (e, data) {/////The operation executed after upload is var imgurl = Json.parse (data.result). data; $ ("#weixin_show"). attr ("src", imgurl); $ ("#weixin_upload"). CSS ({display: "none"}); $ ("#weixin_cancle"). CSS ({display: "}"); }); }); </Script>
Jquery-file-upload attachment Upload