express code
app.post('/upload', multipartMiddleware, function(req, resp) {
var restaurante = new Parse.Object("Restaurante");
var logo =(req.files.imagen);
var file = new Parse.File("logo", req.files.imagen);
restaurante.set("logo",file);
restaurante.save();
});
The form from where I send the file is
<div class="modal-content">
<a href="#!" class="modal-action modal-close">
<i class="fa fa-times" aria-hidden="true"></i>
</a>
<h5>Elige archivo</h5>
<div class="file-field input-field">
<div class="btn file-upload-button">
<span>Archivo</span>
<input type="file" name="logo">
</div>
<div class="file-path-wrapper">
<input class="file-path validate" type="text">
</div>
</div>
</div>
<div class="modal-footer">
<a href="#!" class=" modal-action modal-close waves-effect waves-green btn-flat">Continuar</a>
</div>
</div>
</div>
and what it prints to me is the following
this is what contains console.log (logo);
{ fieldName: 'imagen',
originalFilename: '511c67187eadd5b4f2a22e5f0af12c9a_tikua.png',
path: '/tmp/kR1rUFxfxZFeE3u4uoH7Y-f7.png',
headers:
{ 'content-disposition': 'form-data; name="imagen"; filename="511c67187eadd5b4f2a22e5f0af12c9a_tikua.png"',
'content-type': 'image/png' },
size: 10331,
name: '511c67187eadd5b4f2a22e5f0af12c9a_tikua.png',
type: 'image/png' }
TypeError: Cannot create a Parse.File with that data.