Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unhandled promise rejection TypeError: FileAPI is null #14

Open
bnlambert opened this issue Nov 20, 2016 · 9 comments
Open

Unhandled promise rejection TypeError: FileAPI is null #14

bnlambert opened this issue Nov 20, 2016 · 9 comments

Comments

@bnlambert
Copy link

Hi!
I just started using redux-file-upload. My code looks like this
<FileUpload allowedFileTypes={['jpg', 'pdf']} data={{ type: 'picture' }} dropzoneId="fileUpload" url="http://btcoms.com/upload" > <button> Click or drag here </button> </FileUpload>

When I upload a file I get the following error in my console

Unhandled promise rejection TypeError: FileAPI is null

How do I proceed from here?

@dnuske
Copy link

dnuske commented Dec 5, 2016

I have the same error, been reading about FileAPI but haven't found the source of the problem yet.

@shamoons
Copy link

Same - I get

GET http://localhost:5000/dist/FileAPI.flash.swf?r=2.0.21 404 (Not Found)

@didxga
Copy link

didxga commented Mar 18, 2017

same here: Unhandled rejection TypeError: Cannot read property 'getFiles' of null
Dig little into the code found the solution for me:

the environment variable process.env.IS_BROWSER need to be set to true,
I used webpack so set it in webpack.config.js solved my problem

plugins: [
    new webpack.DefinePlugin({
      "process.env": {
        IS_BROWSER: JSON.stringify( 'true') // default value if not specified
      }
    }),
]

However it's only a workaround sol.

@karladler
Copy link

Somebody should change this line...

const FileAPI = process.env.IS_BROWSER ? require('fileapi') : null;

@Lokesh235
Copy link

I am also getting, Unhandled promise rejection TypeError: FileAPI is null.
Any resolution on it?

@kepi74
Copy link

kepi74 commented Oct 26, 2017

@jakubkottnauer @alcedoatthis
Can you check this error, please?

@proxiex
Copy link

proxiex commented Oct 28, 2017

@jakubkottnauer @alcedoatthis
i am getting the same issue too.
Seems this line of code is probably the cause
const FileAPI = process.env.IS_BROWSER ? require('fileapi') : null;

@tommyalvarez
Copy link

Same error here did anyone fix it somehow? Any other alternative library?

@ramast
Copy link

ramast commented Mar 14, 2018

didxga has mentioned the solution above

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants