nervgh / angular-file-upload

[ALMOST NOT MAINTAINED] Angular File Upload is a module for the AngularJS framework
MIT License
3.44k stars 1.13k forks source link

How to hide the input element and trigger the file upload with another control #862

Open VosWouter87 opened 5 years ago

VosWouter87 commented 5 years ago

Using a custom upload button and/or drag-n-drop area and custom upload function When trying to implement this control into my site, I get the following error: 'TypeError: "Uploader" must be an instance of FileUploader' When I can't use the provided uploader. I've tried using the FileUploader, this doesn't help. After choosing a file, my ng-model value hasn't changed, and thus my ng-change event won't trigger.

I've tried making a JSFiddle to demonstrate this, but it keeps failing with the error "Error: [$injector:nomod] Module 'app' is not available!" When I've clearly registered app with:

var app = angular.module('app', [
    'angularFileUpload'
]);

When using the code on my site it does properly change the file name on the control itself. If I leave the control visible. But I can't use the default file upload button and want it to remain hidden. Instead I need a custom upload button and function.

I'm using version 2.5.0 of the control

ygj6 commented 4 years ago

@VosWouter87 You can refer to the https://github.com/ygj6/angular-file-upload/commit/dc92cb7ac3d72fe0a732b4ff427e4f5e5b5abb01. It supports custom upload buttons and also supports dragging files. Hope that can help you.