title: Need the complete code for uploading a picture in dojo
body: <p>I need the complete code for uploading a file in dojo.
  Especially the ajax call and its button creation, and its url must get stored into database. I use the following code, but it's not working:</p>
  
  <pre><code>function uploadPicture()
  {
      alert("yes");
      var xhrArgs = {
          url:"/service/ajax/uploadPictureToOption/",                 
          form: dojo.byId("optionsForm"),
          handleAs: "json",
          content :{},
          load: function(response, ioArgs){
              if (response == "failed")
              {
                  alert("Failed");
                  window.location.reload();
              }
              else if (response == "success")
              {
                  window.location.reload();
              }
              else
              {
                  alert("Successfully deleted");
                  window.location.reload();
              }
          },
      }
      var deferred = dojo.xhrPost(xhrArgs);
  }
  </code></pre>