我正在尝试将文件(pdf)加载到解析中,但我的解析中没有显示任何内容,所以我假设错误在于以下代码(请注意我创建了一个新的自定义类扫描)。
<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>
非常感谢任何帮助。