title: Parse JavaScript Upload or update file match objectId of row in table
body: <p>I am also new on Parse.com. I have done upload file through Javascript, but I want to do that file upload against a row in class by find "objectId". But I can't find any solution :(</p>
  
  <p>Below is my code where I am upload file...</p>
  
  <pre><code>&lt;html&gt;
              &lt;head&gt;
              &lt;script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"&gt;&lt;/script&gt;
              &lt;script type="text/javascript" src="http://www.parsecdn.com/js/parse-1.2.15.min.js"&gt;&lt;/script&gt;
              &lt;script type="text/javascript"&gt;
              Parse.initialize("2Rsgjz6VQiozYpqQClfmBHQASTTtrdQpUoe2", "fIccKcC9sMH48CKkGYIk62wsA8tTgPpByip");
  
  
                $(function() {
                  var file;
  
                  // Set an event listener on the Choose File field.
                  $('#fileselect').bind("change", function(e) {
                    var files = e.target.files || e.dataTransfer.files;
                    // Our file var now holds the selected file
                    file = files[0];
                  });
  
                  // This function is called when the user clicks on Upload to Parse. It will create the REST API request to upload this image to Parse.
                  $('#uploadbutton').click(function() {
                    var serverUrl = 'https://api.parse.com/1/files/' + file.name;
  
                    $.ajax({
                      type: "POST",
                      beforeSend: function(request) {
                        request.setRequestHeader("X-Parse-Application-Id", '2Rsgjz6VQiozYpxWBfmBHQASTTtrdQpUoe2');
                        request.setRequestHeader("X-Parse-REST-API-Key", 'UPxPXDIkkC6lc52TYpQZ4bX5DjrWH9Wy7');
                        request.setRequestHeader("Content-Type", file.type);
                      },
                      url: serverUrl,
                      data: file,
                      processData: false,
                      contentType: false,
                      dataType: 'json',
                      success: function(data) {
                      var file_input = document.getElementById("url").innerHTML = '&lt;a href="' + data.url + '"&gt;'+ data.url + '&lt;/a&gt;';
                      var classUrl = "https://api.parse.com/1/classes/sampleClass"
  
                       if(data) {
  
              var fileName = "" + data.name;
              $.ajax({
                  type: "POST",
                  beforeSend: function(request) {
                      request.setRequestHeader("X-Parse-Application-Id", '2Rsgjz6VQiozYpqQClcxWBfmBHQASTTtrdQpUoe2');
                      request.setRequestHeader("X-Parse-REST-API-Key", 'UPxPXDIkkCLY2M2b56lc52TYpQZ4bX5DjrWH9Wy7');
                      request.setRequestHeader("Content-Type", 'application/json');
                  },
                  url: classUrl,
                  data: '{"upload" : {"name" : '+"\""+fileName+"\""+', "__type" : "File"}}',
                  processData: false,
  
                  success: function(data) {
                      console.log("Image successfully uploaded.");
                  },
  
                  error: function(error) {
                      console.log("Error: " + error.message);
                  }
              });
  
          } else {
              //Data is null
              console.log("Data IS NULL");
          }
  
                      },
                      error: function(data) {
                        var obj = jQuery.parseJSON(data);
                        alert(obj.error);
                      }
                    });
                  });
  
  
                });
              &lt;/script&gt;
  
              &lt;/head&gt;
              &lt;body&gt;
  
              &lt;div id="url"&gt;
              &lt;/div&gt;
  
              &lt;form id="fileupload" name="fileupload" enctype="multipart/form-data" method="post"&gt;
                &lt;fieldset&gt;
                  &lt;input type="file" name="fileselect" id="fileselect"&gt;&lt;/input&gt;
                  &lt;input id="uploadbutton" type="button" value="Upload to Parse"/&gt;
                &lt;/fieldset&gt;
              &lt;/form&gt;
  
  
              &lt;/body&gt;
  
              &lt;/html&gt;
  </code></pre>