redux-file-upload icon indicating copy to clipboard operation
redux-file-upload copied to clipboard

Unhandled promise rejection TypeError: FileAPI is null

Open bnlambert opened this issue 8 years ago • 9 comments

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?

bnlambert avatar Nov 20 '16 13:11 bnlambert

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

dnuske avatar Dec 05 '16 22:12 dnuske

Same - I get

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

shamoons avatar Dec 28 '16 15:12 shamoons

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.

didxga avatar Mar 18 '17 03:03 didxga

Somebody should change this line... https://github.com/blueberryapps/redux-file-upload/blob/7d537fb7e0964015e5c61ae8c547ff0f1275c3aa/src/helpers.js#L3

karladler avatar May 26 '17 12:05 karladler

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

Lokesh235 avatar Oct 26 '17 10:10 Lokesh235

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

kepi74 avatar Oct 26 '17 10:10 kepi74

@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;

proxiex avatar Oct 28 '17 23:10 proxiex

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

tommyalvarez avatar Dec 22 '17 12:12 tommyalvarez

didxga has mentioned the solution above

ramast avatar Mar 14 '18 22:03 ramast