title: Delete image using pick interface - Firefox OS
body: <p>I've got similar code as shown below where when the user presses the load button they get the pick UI and can press and image then it gets displayed. However I'm struggling with a delete button, I want to use the pick UI again and just change the onsuccess part, I've been experimenting with what it says here <a href="https://developer.mozilla.org/en/docs/WebAPI/Device_Storage#Delete_a_file" rel="nofollow">https://developer.mozilla.org/en/docs/WebAPI/Device_Storage#Delete_a_file</a> but I can't get it to delete the image I choose.</p>
  
  <pre><code>var pickImage = document.querySelector("#delete-image");
  if (pickImage) {
      pickImage.onclick = function () {
          var pick = new MozActivity({
              name: "pick",
              data: {
                  type: ["image/png", "image/jpg", "image/jpeg"],
                  nocrop: true
             }
          });
  
          pick.onsuccess = function () {
            var img = document.createElement("img");
  
            var request = img.delete("img");
  
            request.onsuccess = function () {
              console.log("File deleted");
            }
  
            request.onerror = function () {
              console.log("Unable to delete the file");
            }
          };
      }
  }
  </code></pre>