uploadcare / uploadcare-node

Node module for uploadcare.com
MIT License
37 stars 21 forks source link

Uncaught TypeError: form.submit is not a function #16

Closed gavyncaldwell closed 6 years ago

gavyncaldwell commented 7 years ago

here is my code: uploadcare('puiblic-id').file.upload(event.target.files[0], (err, res) => { console.log(err,res) }) when i call this i get the error above! How do I fix this?

RexMorgan commented 7 years ago

What is event.target.files[0]? If it's a file path, be sure to call fs.createReadStream with the path and send that into the upload function.

Take a look at the examples: https://github.com/RexMorgan/uploadcare-node/blob/master/examples/usage.js#L18

Also, make sure you're providing your public and secret keys, in your example you're only providing the public key.

Let me know if this doesn't help you.