AngularJS File-up-load Upload Image

Source: Internet
Author: User

<div class= "Form-group" >
<label class= "col-xs-2 control-label col-xs-offset-1" > System pictures </label>
<div class= "Col-xs-7" >
<div class= "Input-group" ng-show= "YES" >

<input class= "File-name form-control" type= "text" readonly= "readonly" id= "Fileitem" value= "{{fileitem.name}}" Ng-model= "Fileitem.name"/>
<div class= "INPUT-GROUP-BTN" >
<input type= "File" accept= "image/*" file-model= "myFile" name= "certificate" class= ' input-file files fff ' id= "F" oncha Nge= "Txt.value=this.value" size= "1" hidefocus nv-file-select uploader= "uploader"/>
<input type= "button" onmousemove= "F.style.pixelleft=event.x-60;f.style.pixeltop=this.offsettop;" value= "Select Picture" size= "onclick=" F.click () "class=" Btn-info btn Liulan ">
</div>
</div>
<div class= "Input-group" ng-show= "NO" >
<div class= "INPUT-GROUP-BTN" >
<input class= "Form-control" readonly type= "text" name= "Branchpn_add" name= "Sysimagepc_add" value= "{{sysimagepc_ Add}} "Ng-model=" Sysimagepc_add "style=" width:82%; " >
<input type= "button" value= "re-select" ng-click= "Chooseagain ()" size= "" class= "Btn-info btn Liulan" >
</div>
</div>

<div class= "Input-group imgsrc" ng-show= "yess" >

</div>
<br/>
<a class= "btn btn-info" ng-click= ' UploadFile () ' > Uploads </a>
<a class= "btn btn-default" ng-click= "Editloadfile ()" > Cancel </a>
</div>



</div>


New system-pop-up window starts
$scope. Addsystem = function () {
$scope. yess = T2;
$scope. YES = T1;
$scope. NO = T2;
$scope. imagesrc = "";
$ (' #fileItem '). Val ("");
$scope. Createuser_add = $scope. Loginlist.employeename
}
New System-Re-select
$scope. Chooseagain = function () {
$scope. YES = T1;
$scope. yess = T2;
$scope. NO = T2;
$scope. Fileitem = null;
$scope. imagesrc = false;
}

New system-Upload Image Preview
$scope. GetFile = function () {
Filereader.readasdataurl ($scope. File, $scope)
. then (function (Result) {
$scope. Sysimagepc_edit = result;
$scope. yess = T1;
$scope. Sysimagepc_edit = result;
$scope. imagesrc = result;
$scope. Fileitem = $scope. File;
});
};

New System-click Upload
$scope. Uploadstatus = false;
var uploader = $scope. Uploader = new Fileuploader ({
URL: '/fileservlet ',
Queuelimit:1,
Removeafterupload:true
});
Uploader.onafteraddingfile = function (Fileitem) {
$scope. Fileitem = Fileitem._file;
};
Uploader.onsuccessitem = function (Fileitem, response, status, headers) {
$scope. Uploadstatus = true;
$scope. Sysimagepc_add = response;
$scope. Sysimagepc_edit = response;
$scope. yess = T2;
$scope. YES = T2;
$scope. NO = T1;
};
$scope. UploadFile = function () {
Uploader.uploadall ();
};

New product-Select Image--Cancel
$scope. Editloadfile = function () {
$scope. YES = T1;
$scope. yess = T2;
$scope. NO = T2;
$ (' #fileItem '). Val ("");
$scope. Fileitem = $scope. Sysimagepc_edit;
};

This article from "Purple Maple 5966" blog, reproduced please contact the author!

AngularJS File-up-load Upload Image

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.