0

I am trying to load file (pdf) into parse, but nothing is showing up in my parse so I am assuming an error lies in the following code (note I created a new custom class scan).

<HTML>
<head>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
</head>

<body>
<form id="fileupload" name="fileupload" enctype="multipart/form-data" method="post">
 <input type="file" id="pic">
   <input type="submit" value="Submit">


</form>

<script type="text/javascript">
    Parse.initialize("id", "id");


   var products = Parse.Object.extend("Product");

  var fileUploadControl = $("#pic")[0];
if (fileUploadControl.files.length > 0) {
var file = fileUploadControl.files[0];
var name = "photo.png";

var parseFile = new Parse.File(name, file);
}
parseFile.save().then(function() {
  //The file has been saved to Parse.
   }, function(error) {
   // The file either could not be read, or could not be saved to Parse.
 });


    </script>


</head>
</body>
</HTML>

Any help would be greatly appreciated.

  • i'm assuming the code you pasted is incomplete as Parse JS library is missing; try to wrap your code into `$('#fileupload').submit(function(){})` as without it won't give you your `file` variable as you expect it. I would recommend to go through following [link](http://stackoverflow.com/a/23540479/2609269). Also keep in mind that there's 10MB file size limit per file being uploaded to Parse. – David Jirman Dec 29 '14 at 04:13
  • Administrator Any luck cracking it? – David Jirman Jan 02 '15 at 23:21

0 Answers0