2

How exactly do I go about storing profile images for in the Users object?

M. Junaid Salaat
  • 3,765
  • 1
  • 23
  • 25

2 Answers2

3

You can use a Base64 encoded image to save in the user object.

Helpful articles covering this are base64-images and data-uris

Hope it helps.

M. Junaid Salaat
  • 3,765
  • 1
  • 23
  • 25
2

In Backand server side add the "Backand Storage" action, with this code:

function backandCallback(userInput, dbRow, parameters, userProfile) {
  // upload file
  if (request.method == "POST"){
    var url = files.upload(parameters.filename, parameters.filedata);
    return {"url": url};
  }
  // delete file
  else if (request.method == "DELETE"){
    files.delete(parameters.filename);
    return {};    
  }
}

And on the client side you can use this code in Ionic, it is based to copy the code from here: backand docs

Itay
  • 734
  • 4
  • 5
  • 1
    Great! But, how can I make it so that the uploaded file is linked to a specific id in the object? –  Apr 03 '16 at 22:46