javascriptangularjsionic-frameworkbackand

How do I store images with Backand and Ionic?


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


Solution

  • 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