angular.js base64 file upload

علی ذوالفقار
1399/06/01 09:25:57 (714)
https://github.com/adonespitogo/angular-base64-upload
Bower - bower install angular-base64-upload
NPM - npm install angular-base64-upload

angular.module('myApp', ['naif.base64']);
< input type='file' ng-model='yourModel' base-sixty-four-input >

return :
{
"filesize": 54836, /* bytes */
"filetype": "image/jpeg",
"filename": "profile.jpg",
"base64":   "/9j/4AAQSkZJRgABAgAAAQABAAD//gAEKgD/4gIctcwIQA..."
}
multi[ple file selection : 
 
 
 
 Validations
maxsize = Maximum file size in kilobytes (KB) (applied to all files when multi-select is enabled)
minsize = Minimum file size in kilobytes (KB) (applied to all files when multi-select is enabled)
maxnum = Maximum number of items to select (applicable only for multi-select)
minnum = Minimum number of items to select (applicable only for multi-select)
accept = Input file accept attribute. file_extension|audio/*|video/*|image/*|media_type comma separated
required = Checks if the model value is null, empty array [] or empty object {}

  < input type="file" ng-model="files" name="files" multiple accept="image/*, .zip" maxsize="5000" required base-sixty-four-input>
  < span ng-show="form.files.$error.maxsize">Files must not exceed 5000 KB< /span>

            
Back