Skip to content

Instantly share code, notes, and snippets.

@srph
Last active February 13, 2018 11:05
Show Gist options
  • Save srph/15a30519e56041463ad61ffd3f515bb5 to your computer and use it in GitHub Desktop.
Save srph/15a30519e56041463ad61ffd3f515bb5 to your computer and use it in GitHub Desktop.

error

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>TypeError: Cannot read property &#39;originalname&#39; of undefined<br> &nbsp;

 &nbsp;at addObject (/var/www/file.io/app.js:78:11)<br> &nbsp; &nbsp;at /var/www/fi

le.io/app.js:195:2<br> &nbsp; &nbsp;at Layer.handle [as handle_request] (/var/www/f

ile.io/node_modules/express/lib/router/layer.js:95:5)<br> &nbsp; &nbsp;at next (/va

r/www/file.io/node_modules/express/lib/router/route.js:137:13)<br> &nbsp; &nbsp;at
Object.&lt;anonymous&gt; (/var/www/file.io/node_modules/multer/lib/make-middleware.

js:53:37)<br> &nbsp; &nbsp;at Object.immediate._onImmediate (timers.js:381:16)<br>
&nbsp; &nbsp;at processImmediate [as _immediateCallback] (timers.js:363:15)</pre>
</body>
</html>
const axios = require('axios')
const FormData = require('form-data')
const fs = require('fs')
fs.readFile('f.txt', async function(err, file) {
if (err) {
console.log('err', err)
return
}
try {
const res = await axios.post('https://file.io', {
file
})
console.log(res.data)
} catch(e) {
console.log(e.response.status)
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment