redux-file-upload
redux-file-upload copied to clipboard
Unhandled promise rejection TypeError: FileAPI is null
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?
I have the same error, been reading about FileAPI but haven't found the source of the problem yet.
Same - I get
GET http://localhost:5000/dist/FileAPI.flash.swf?r=2.0.21 404 (Not Found)
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.
Somebody should change this line... https://github.com/blueberryapps/redux-file-upload/blob/7d537fb7e0964015e5c61ae8c547ff0f1275c3aa/src/helpers.js#L3
I am also getting, Unhandled promise rejection TypeError: FileAPI is null. Any resolution on it?
@jakubkottnauer @alcedoatthis Can you check this error, please?
@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;
Same error here did anyone fix it somehow? Any other alternative library?
didxga has mentioned the solution above