我正在尝试使用https://github.com/danialfarid/angular-file-upload但显然我无法访问该文件
我的 HTML
<img
src = "{{ userPhotoUrl }}"
alt = ""
class = "img-circle img-responsive"
accept = "image/*"
data-multiple = "false"
ng-file-select = "onFileSelect($file)"
>
我的咖啡脚本:
$scope.onFileSelect = ($file) ->
console.log $file
$scope.upload = $upload.upload
url : '/api/upload/photo'
file : $file
method : 'POST'
.progress (e) ->
console.log 'percent' + parseInt 100.0 * e.loaded / e.total
.success (data, status, headers, config) ->
console.log data, status, headers, config
我undefined
刚从console.log($file)
有什么问题?我试图将相同的逻辑放入
<input type="file" ng-file-select="onFileSelect($file)">
但我得到相同的结果