Giter VIP home page Giter VIP logo

kzrfaisal / angular-file-uploader Goto Github PK

View Code? Open in Web Editor NEW
121.0 8.0 81.0 1.01 MB

Angular file uploader is an Angular 2/4/5/6/7/8/9/10/11/12/13 + file uploader module with Real-Time Progress Bar, Responsive design, Angular Universal Compatibility, localization and multiple themes which includes Drag and Drop and much more.

Home Page: https://www.npmjs.com/package/angular-file-uploader

TypeScript 64.02% CSS 7.45% HTML 28.52%
angular file file-upload upload uploader module npm npm-package image-upload image

angular-file-uploader's People

Contributors

anderstornkvist avatar dependabot[bot] avatar eduardoroth avatar faisal-hearth avatar kzrfaisal avatar olha avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

angular-file-uploader's Issues

Http Headers inclusion via Http Interceptor

I'm trying to send a POST file request but no authorization header is appended to the request. I'm using HttpInterceptors, are they supported or your component's POST call?

Doesn't work with aot

Compiler error when attempting to run Angular 5 with ng serve --aot:

ERROR in Error during template compile of 'FileUploadModule'
  Function calls are not supported in decorators but 'makeDecorator' was called in 'NgModule'
    'NgModule' references 'NgModule'
      'NgModule' references 'NgModule'
        'NgModule' references 'NgModule'
          'NgModule' calls 'makeDecorator'.

Suggestion: directly upload on select

Hi there,

love your package.

I did some user testing and some folks don't click on the upload Button after selecting a file. It would be cool to have this as an option. Or an output event onFileSelect and an input to upload files.

What do you think?

cheers

File parameter name

I noticed that if I upload multiple files, they are named "file0", "file1" etc:

-----------------------------5936291719523
Content-Disposition: form-data; name="file0"; filename="a2.txt"
Content-Type: text/plain

22222
-----------------------------5936291719523
Content-Disposition: form-data; name="file1"; filename="a1.txt"
Content-Type: text/plain

11111
-----------------------------5936291719523--

In the Spring Controller I would like to receive the files as array, which does not work since they have all different names.

Can you tell me how I can have all the files just be named "file" ?

Override or remove MessageText

Hello, I would like to override or hide the text
this.uploadMsgText = "Successfully Uploaded !";
with my own logic and with another language.

This is my code:

  afuConfig = {
      multiple: false,
      formatsAllowed: ".jpg,.png",
      maxSize: "1",
      uploadAPI:  {
        url:"https://file.io" // demo
      },
      theme: "dragNDrop",
      hideProgressBar: false,
      hideResetBtn: true,
      hideSelectBtn: false
  };

  DocUpload(env) {
    var obj = JSON.parse(env.response);
    console.log(obj);  // the API will return {"success":true/false,"message":"The files have errores", "data": {...}}
    if(obj.success)
      console.log('GO TO ANOTHER PAGE');
    else
      console.log('SHOW A DIV WITH SOME ERROR DESCRIPCION (FROM obj.message) AND LOAD obj.data');
  }

Thanks in advance

defineInjectable Not found

Hey.
How are you?
My name is Guy and I tried to implement your upload-file plugin in a project of mine.
Implementing It on an empty project was easy and worked beautifully but when I plugged it into a working project this message popped up:

WARNING in ./node_modules/angular-file-uploader/fesm5/angular-file-uploader.js
24:66-82 "export 'defineInjectable' was not found in '@angular/core'

And my app crushed.
I have an ng5 project.

The 'defineInjectable' does exists.
And the dependencies also is up to date.
Do you have any idea what could have went wrong?
Maybe it's a versioning issue?

Hope to hear from you soon.

Best regards,
Guy Reshef

localization

hi,
first things first, thank you for this good module.

how can i change the strings and styles of this module!?

ResponseType

Can the config be modified to pass a response type for the xmlhttprequest? I need a blob response and there is not a way to pass the responsetype

Translation

Awesome work! Love the component!
Question: how can I translate the component? My app is in Brasilian-Portuguese. Whats my best option, besides forking this project and translating it?

Thank you!

Send file in service

I need to send file through service and send csrf with file .Is there any example to help me?

Multiple files use the same name; only last one appears on server

I think this is the Caption property. If it is empty it gets set to file for each file. Each section in the request has name='file'. When it hits my backend running Laravel, only the last file is available. Seemingly this is because it uses the name attribute to build its array of files. I can't see any way to change the Caption array.

How to hide buttons while uploading

Hello,

Can someone point me in the correct direction of documentation that explains how to hide the "Select File", "Reset" and "Upload" buttons and also get percentage value as uploading to change custom progress bar when the data transfer is happening? I can only see (ApiResponse)="fileUploaded($event)" as an event after the API returns.

Thank you.

'Select File' does not work in IE 11

I know nobody cares about IE anymore, but I have to support it. Drag an drop seems to work. Using the select button allows you to choose a file, but it doesn't get listed in the selected files.

Problems with authorization headers

Hi, When I send the request with:
afuConfig = {
uploadAPI: {
url: 'https://xxxxxxxxxxx/xxxxxxxxxxx/storedFile/',
headers: {
"Content-Type" : "multipart/form-data; ",
"Authorization" : localStorage.getItem('authorization')
}
},
multiple: true,
maxSize: "1",
theme: "dragNDrop"
};
the URL is ok but it get me a bad response (No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:4200' is therefore not allowed access. The response had HTTP status code 400).
What I can do?

unknow defineInjectable

I'm using angular 5.2, showing error as unknow defineInjectable in angular core.
Working fine when I have changed to defineInjectable to Injectable.
please update the same in npm repo in angular-file-uploader/fesm5/angular-file-uploader.js

in line number 1:
import { Injectable, NgModule, defineInjectable, EventEmitter, Component, Input, Output } from '@angular/core'; should be import { Injectable, NgModule, Injectable, EventEmitter, Component, Input, Output } from '@angular/core';

in line number 19:

'AngularFileUploaderService.ngInjectableDef = defineInjectable({ factory: function' Should be
/** @nocollapse */ AngularFileUploaderService.ngInjectableDef = Injectable({ factory: function

configuration object issue - replaceTexts

Hi, I have been trying to reassign the default values in 'replaceTexts' object in [email protected], but the changes are not being detected at all.
Furthermore, when trying to use the latest version, the module is not being recognized at all, i.e. I cannot import the { AngularFileUploaderModule } from 'angular-file-uploader'

Regarding the text

I wanted the 'Drag N Drop' text to be replaced by below
image.

And I wanted it in the HTML file. so whatever the labels in 'replaceTexts' are in TS file, but I wanted it in HTML file.

Could you please let me know how can this be done.

typo in package.json

hello

in the scripts section there is a typo:
"build-afu":"ng build angular-fil-uploader"

this gives an error and should be:
"build-afu":"ng build angular-file-uploader"

thanks for the module 👍

Styling the progress bar

The progress bar appears to be very very small. Is there any specific ID or class on the progress bar so that i can style it? The upload happens too quickly for me to inspect and it appears that it's hidden on the DOM unless an actual upload is taking place.

Does it support I18n(other languages)?

Hello,

excellent job bro, nicely done but I do have project that will use three languages so is it possiable?
can you tell me how to append my own id with file name uploaded ?

AngularFileUploaderModule

I have encountered the following error when I upgraded from 4.0.5 to 4.1.2

WARNING in ./src/app/app.module.ts
58:16-41 "export 'AngularFileUploaderModule' was not found in 'angular-file-uploader'

ERROR in ./node_modules/angular-file-uploader/index.js
Module build failed: Error: ENOENT: no such file or directory, open 'C:\Users\Qarun\Desktop\Internship project\ng-test\uwiprogrammes\node_modules\angular-file-uploader\index.js'

Are any fixes for this?
I will revert back to 4.0.5 for now

the same id

If you use multiple loaders on the same page, it is likely that the input will be assigned the same id. Please make it possible to specify id in configuration or complicate id generation

Add parameters to request

Please add a way to add parameters to the request.

There are often cases where it's necessary to add metadata to a posted file.

Thanks.

Config changes are not being detected

changes to config.uploadAPI.headers is not being detected and angular file upload uses old/initial auth header.

angular-file-uploader/projects/angular-file-uploader/src/lib/angular-file-uploader.component.ts line 50
never gets fired when config gets updated with new values:

also not sure why in ngOnChanges this.config is being used instead of rst["config"] ?


ngOnChanges(rst: SimpleChanges) {
    if (rst["config"]) {
....

<angular-file-uploader #fileUpload1 [config]="config" (ApiResponse)="uploadResponse($event)"></angular-file-uploader>

I've also tried object assign and reinitializing config but ngOnChanges is not being fired
any suggestions?

Thanks

Add formData

Any help on add form-data in config or in any other place ?
I need to send id in url or in request but i can't do.
Please let me know how i can do.

Not able to handle exceptions

Hi
We are using angular-file-uploader (Ver. 4.1.2). I’ve set up config for the same and in the config I’ve set formatsAllowed = .xls, .xlsx. But when user selects All Files option on Open Dialog and selects file with unwanted extension though it is not throwing an exception but we need some way to handle such scenario, so that, we can show proper message to user.

Component URL: https://www.npmjs.com/package/angular-file-uploader (https://www.npmjs.com/package/angular-file-uploader)
Thank you!

Kind regards,
Madan Deshpande PMP® ITIL

i need change method

It had method POST as default. We should have method field in config to set it to PUT, PATCH...My api need PUT not POST.

Thanks!

page doesn't load OR becomes blank

When I add the following tag in my page, the page doesn't load OR becomes blank.

<angular-file-uploader #fileUpload1
[config]="afuConfig"
[resetUpload]=resetVar
(ApiResponse)="DocUpload($event)">

What am I missing? Or can you provide complete sample implementation of a page?

file content on body

How can us send the file content on request body? API get me an error because the body is bad built.
And, if the API get a response, how I can manage it? Thanks!

It is only uploading the second file

Hello,

I'm trying to upload multiple files at the same time but it is taking only second file.
I'm using latest angular version 6 and spring boot for back end.

image
image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.