cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

Quick-add: + add another resource

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

Quick-add: + add another resource

Code Indentation


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

              <body class="container" ng-app="app" ng-controller="DemoCtrl">
  <h2>Backand Simple Upload File</h2>
  <h4>Explore Backand File functioanlity by upload or delete a file</h4>
  <form role="form" name="uploadForm">
    <div class="row">
        <img ng-src="{{imageUrl}}" ng-if="imageUrl"/>
        <input id="fileInput" type="file" accept="*/*" ng-model="filename" />
        <input type="button" value="x" class="delete-file" title="Delete file" ng-disabled="!imageUrl" ng-click="deleteFile()" />
      <p ng-if="imageUrl">Image URL = {{imageUrl}}</p>
  To use this example with your app follow these steps
        Set your app name and security token in the config:
myApp.config(function(BackandProvider) {
   // enter your app name here
   BackandProvider.setAppName('your app name here');
   // enter your app anonymous token here
   BackandProvider.setAnonymousToken('your app anonymous token here');
    Create a server side action in Backand<br>
    by going into the items object actions tab<br> 
    and clicking on the Back& Files icon.<br>
    Name your action "files"<br>
  width: 220px;
              var myApp = angular.module('app', ['backand']);

// Backand security configuration for your app
myApp.config(function(BackandProvider) {
  // enter your app name here
  // enter your app anonymous token here

myApp.controller('DemoCtrl', ['$scope', 'Backand', DemoCtrl]);

function DemoCtrl($scope, Backand) {

  // Create a server side action in backand
  // Go to any object's actions tab 
  // and click on the Backand Storage icon.
  // Backand consts:
  var objectName = 'todo';
  var filesActionName = 'files';
  // Display the image after upload
  $scope.imageUrl = null;
  // Store the file name after upload to be used for delete
  $scope.filename = null;
  document.getElementById('fileInput').addEventListener("change", function () {
    var file    = document.querySelector('input[type=file]').files[0];
    var reader  = new FileReader();

    reader.addEventListener("load", function () {
      // console.log(file);
      // console.log(reader);
      Backand.file.upload(objectName, filesActionName, file.name, reader.result)
      .then(function (response) {
        $scope.imageUrl = response.data.url;
        $scope.filename = file.name;
    }, false);

    if (file) {
  }, false);

  $scope.deleteFile = function(){
    if (!$scope.filename){
      alert('Please choose a file');
    // By calling the files action with DELETE method in will perform 
    // a deletion of the file from Backand Storage
    return Backand.file.remove(objectName, filesActionName, $scope.filename).then(function(res){
      // Reset the form
      $scope.imageUrl = null;
      document.getElementById('fileInput').value = "";
  $scope.initCtrl = function() {
Loading ..................