Upload an image parse.com

I am trying to upload an imagen but when i save the information I can saw the image.Can you help me?

            <!-- file-->
        <div class="form-group">
          <label class="col-md-4 control-label" for="">Foto</label>
          <div class="col-md-8">
            <input id="imagen" name="imagen" class="form-control input-md" type="file">
         </div>
        </div>

I have this input and

var bytes = [ 0xBE, 0xEF, 0xCA, 0xFE ];
var url = req.body.imagen;
var file = new Parse.File(url, bytes);
file.save().then(function() {
          alert("Save");
        }, function(error) {
          alert("Fail");
        });

I use the javascript guide but i dont know what i miss

Upvotes: 0

Views: 68

Answers (1)

Shanoor
Shanoor

Reputation: 13662

You should try with var url = req.body.imagen.path; or var url = req.files.imagen.path;.

You forgot .path for your url variable. imagen is an object containing various informations about the uploaded file (path for tmp folder, name, size...).

Upvotes: 1

Related Questions