保存图像crope结果有角度2

时间:2017-10-07 14:33:10

标签: c# asp.net-mvc angular

我使用ngImgCrop上传图片并裁剪图片。我想保存 <img-crop image="myImage" result-image="myCroppedImage"></img-crop> 结果图像到asp.net mvc C#中的文件夹。 怎么做?

1 个答案:

答案 0 :(得分:0)

ctrl.js中的

    $scope.upload = function (dataUrl, name) {
    Upload.upload({
        url: 'http://meminfo.hamotaghieman.ir/api/Upload/user/PostUserImage',
        data: {
            file: Upload.dataUrltoBlob(dataUrl, name)
        },
    }).then(function (response) {
        $timeout(function () {
            $scope.result = response.data;
        });
    }, function (response) {
        if (response.status > 0) $scope.errorMsg = response.status
            + ': ' + response.data;
    }, function (evt) {
        $scope.progress = parseInt(100.0 * evt.loaded / evt.total);
    });
}

并在cshtml文件中:

 <form name="form" class="col-sm-12">
        آپلود فایل

        <button class="btn btn-danger col-lg-push-4 col-xs-8"
                placeholder="upload"
                type="file" name="file"
                ngf-select="onChangePackageApk($files)" ng-model="file" accept=".apk"
                ngf-accept="'.apk'" ngf-max-size="10MB" required ngf-model-invalid="errorFile">
            انتخاب فایل
        </button>


        <br />
        <br />
        <div class="row" style="background-color:red">
            <button class="btn btn-success" type="submit" ng-click="submit()">ارسال</button>
        </div>
        <div style="width:{{progress}}%" ng-bind="progress + '%'"></div>
        <div ng-bind="message">شماره تماس 09180 511 75 30</div>
        <div>شماره تماس 09180 511 75 30</div>
    </form>
    <div class="wow animation-element c2 form-group" data-wow-duration="3s">
        <label for="usr">نام:</label>
        <input type="text" class="form-control" ng-model="message" id="usr" />

        <label for="usrr">نام کاربری:</label>
        <input type="text" class="form-control" ng-model="message" id="usrr" />
    </div>