Integrating both simple uploader and drop zone together #64
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Using drop zone uploader, is it possible that whenever i click inside drop zone it opens the window to select file and shows the uploaded file name?
+1
+1
oh, nice one
I solved this wrapping the file-select into the file-drop like this:
try this https://github.com/valor-software/ng2-file-upload/tree/development/demo/components/file-upload/zs-file-demo
I think code is more clear then use drop & select at the same time.
@fojt How to use this demo?
As your template include only
<input>tag withstyle="display: none;", so I guess it is intended to use with other tag or component. I tried to use your DemoFileUploadComponent using<demo-file-upload></demo-file-upload>or<div DemoFileUploadComponent ...></div>, but I got errorTypeError: Cannot read property 'isSkipSelf' of null.I understand the error above occurs because, in short, FileUploader is not @injectable(). So I remove
providers: [FileUploader],line and add@Input() public uploader:FileUploader;so as to get existing FIleUploader instance, and check using<demo-file-upload [uploader]="uploader"></demo-file-upload>from other sample-demo.html. Now I see how your component works.Also it needs little fix for Firefox.
I made this easy solution:
`<div class="dropzone" ng2FileDrop [uploader]="uploader" (click)=fileInput.click()>
`Drop or Click to select files
<input type="file" #fileInput ng2FileSelect [uploader]="uploader" multiple style="display: none;"/>Added the following styles to div to make it cleaner:
.point{
cursor: pointer;
}
.my-drop-zone:hover {
border: dashed 3px green;
}
To implement it right way you just need to replace "div" with "lable" and wrap file input field with it.
Something like:
No need to use "click" at all