Hello, I’ve managed to upload images using a method and fs.writeFile.
I’m writing it down like this:
const appRoot = fs.realpathSync(process.cwd() + '/../')
const publicPath = `${appRoot}/web.browser/app/evidencia`
const filename = `${imageId}.${extension}`
const file = `${publicPath}/${filename}`
try {
fs.writeFile(file, fileData, 'binary', (err) => {
if (err)
throw new Meteor.Error('error-guardar-imagen', 'Error al guardar la imagen. Intenta de nuevo.')
})
} catch (err) {
throw err
}
return filename
The problem is displaying the image once uploaded in development. The folder “evidencia” is not being published. I do not need/want to use CollectionFS. I’m using Meteor 1.4.X + React.
This way, everything under http://your_domain_here/static/ will be served by nginx directly from the /var/www/static directory and everything else will be served by your meteor process.
You thus only need to change your program’s code to this:
Thanks, I was using it a while back, but suddenly something went wrong and couldn’t make it work again.
I added once again and is now working. I’ll test it out. Thank you very much.