danialfarid / ng-file-upload

Lightweight Angular directive to upload files with optional FileAPI shim for cross browser support
MIT License
7.87k stars 1.6k forks source link

Unable to see the $ngfBlobUrl when uploading a PDF #1970

Open ryanhinton opened 7 years ago

ryanhinton commented 7 years ago

Hello,

After pioneering through ng-file-upload for the first time and getting images to work great, I am attempting to allow PDFs for uploading as well. However, I am not getting a $ngfBlobUrl back. The following is the code and I use vm.cacheFiles to handle the data, which is were I am able to see $ngfBlobUrl for images, but not for PDFs.

<div 
    name="uploadFile"
    ngf-select="vm.cacheFiles($files,$errfiles)" 
    multiple
    ngf-model-invalid="vm.saveData.invalidFiles" 
    ngf-multiple="true" 
    ngf-keep= "'distinct'" 

    ngf-drop="" 
    class="drop-box" 
    ngf-drag-over-class="'dragover'"
    ngf-drop-available="true"

    ngf-max-size="10MB"
    ngf-pattern="'.pdf,/*,application/pdf'"
    accept="/*"
>
    <span ng-show="true">Drop Files Here<br> or<br></span>
    Click To Add
</div>

The following is the vm.cacheFiles function that is called within ngf-select attribute.

vm.cacheFiles = function(files, errFiles) {
        console.log(files);
        console.log(errFiles);
}

The console.log allows me to view the files Array of Objects and this is where I can see $ngfBlobUrl for images but it is missing for PDFs. I have attempted to configure the ngf-pattern in various ways and not using it all, including using the accept attribute in the same manner. Do I possibly not have something set up correctly?

Thank you for your time.