The uploader.queue is empty when uploading #878

Open
opened 2017-08-30 04:30:22 +00:00 by ifindthanh · 2 comments
ifindthanh commented 2017-08-30 04:30:22 +00:00 (Migrated from github.com)

Hello guys,

I'm very new in Angularjs and doing an example with upload file using ng2-file-upload

I'm following the content at http://valor-software.com/ng2-file-upload/

My example is simple with just only one input file and one button

html template:
<input type="file" ng2FileSelect [uploader]="uploader"/>
<input type="button" (click)="uploader.uploadAll()" value="UPLOAD"/>
ts file:

import { Component, Directive } from '@angular/core';
import { FileUploader } from 'ng2-file-upload';

@Component({
selector: 'app-upload',
templateUrl: '../views/ng2-file-uploader.html',

})

export class ImageUploadComponent {
public uploader:FileUploader = new FileUploader({
url: 'https://evening-anchorage-3159.herokuapp.com/api/',
allowedMimeType: ['image/png'],
maxFileSize: 1024*1024,
autoUpload: false,
isHTML5: true,
});
}

But when I select an image the click on UPLOAD button, the program doesn't call to any API

I did a debug at the code of ng2-file-upload.js and realize that this.queue.length is 0

Hello guys, I'm very new in Angularjs and doing an example with upload file using ng2-file-upload I'm following the content at http://valor-software.com/ng2-file-upload/ My example is simple with just only one input file and one button html template: <input type="file" ng2FileSelect [uploader]="uploader"/> <input type="button" (click)="uploader.uploadAll()" value="UPLOAD"/> ts file: import { Component, Directive } from '@angular/core'; import { FileUploader } from 'ng2-file-upload'; @Component({ selector: 'app-upload', templateUrl: '../views/ng2-file-uploader.html', }) export class ImageUploadComponent { public uploader:FileUploader = new FileUploader({ url: 'https://evening-anchorage-3159.herokuapp.com/api/', allowedMimeType: ['image/png'], maxFileSize: 1024*1024, autoUpload: false, isHTML5: true, }); } But when I select an image the click on UPLOAD button, the program doesn't call to any API I did a debug at the code of ng2-file-upload.js and realize that this.queue.length is 0
RaniaShady commented 2018-01-10 09:23:45 +00:00 (Migrated from github.com)

Hi,
I had the same issue and it was because of the allowedFileType:
private uploader: FileUploader = new FileUploader({ url: URL, queueLimit: 1, allowedFileType: ["jpg", "jpeg", "png"] });
While I was browsing for a pdf file, so it wasn't added to the queue.

Hi, I had the same issue and it was because of the allowedFileType: private uploader: FileUploader = new FileUploader({ url: URL, queueLimit: 1, allowedFileType: ["jpg", "jpeg", "png"] }); While I was browsing for a pdf file, so it wasn't added to the queue.
dave0688 commented 2018-08-21 12:42:27 +00:00 (Migrated from github.com)

@ifindthanh Please check your maxFileSize. It has to contain a number (in MB) and not the img size.

@RaniaShady your allowedFileType array wrong. Allowed file types are not the extensions. They're defined here: https://github.com/valor-software/ng2-file-upload/issues/696#issuecomment-288531528

@ifindthanh Please check your maxFileSize. It has to contain a number (in MB) and not the img size. @RaniaShady your allowedFileType array wrong. Allowed file types are not the extensions. They're defined here: https://github.com/valor-software/ng2-file-upload/issues/696#issuecomment-288531528
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: dc/ng2-file-upload#878