0

I am using ng2-file-upload for file upload requirement with my angular application. in this directive i can able to set the maxFileSize - but the thing is, there is a way to upload just empty file. so i am looking for a solution to prevent the empty file upload.

is there a way to test it and throw error? or can i set the min size for upload?

here is my config:

this.uploader = new FileUploader({
  isHTML5: true,
  maxFileSize: maxFileSize, //how to set min size?
  queueLimit: queueLimit,
  autoUpload: false,
  headers: [{name: 'Content-Type', value: 'application/octet-stream'}]
});
user2024080
  • 1
  • 14
  • 56
  • 96
  • there is no minsize attribute in ng2-file-upload. You can create your own fork and refer it from your own git hub or you can request the author to add it for you – joyBlanks Sep 16 '19 at 10:52

1 Answers1

1

I don't think you can set a minimum, just do

if(this.uploader.size < 0){
// Let the user know
}
C.Ikongo
  • 1,706
  • 1
  • 16
  • 15