LukasMarx / react-file-upload

MIT License
145 stars 121 forks source link

Save File in the Project #1

Open JoseSilvaSistrade opened 5 years ago

JoseSilvaSistrade commented 5 years ago

You can save the file, in a folder inside of your project?

BenQuirk commented 4 years ago

I'm not entirely sure but I think we have the same question maybe, which is ---

Where are the files that are uploaded? They're not in the server folder.

BenQuirk commented 4 years ago

Images are being saved to a folder inside server/uploads with this code:

server/uploads <-- make this folder first

then edit this file: server/upload.js like this:

const IncomingForm = require("formidable").IncomingForm;

module.exports = function upload(req, res) { var form = new IncomingForm();

form.on('fileBegin', function (name, file){
    file.path = __dirname + '/uploads/' + file.name;
});

};