1
此刻的爱解析只是似乎无法上传文件解析使用JavaScript api(客户端),问题是我似乎无法创建一个解析对象。下面是我的代码:创建一个Parse.File对象
var fileUploadControl = $("#imgInp")[0];
var file = fileUploadControl.files[0];
var name = "photo.jpg";
var parseFile = new Parse.File(name, file);
parseFile.save().then(function() {
// etc
我从铬控制台得到的错误是
TypeError: undefined is not a function
at k.$scope.submitReport
(file:///Users/xxx/Documents/projects/script.js:402:27) <- the line which has var parseFile = new Parse.File(name, file); on it
可能有人阐明这离奇的情况有些光(我相当肯定我下面的文档,以信
https://parse.com/docs/js_guide#files-classes
是'fileUploadControl.files.length> 0'? – Maroshii 2014-10-06 14:16:17
它看起来像'Parse'可能是'undefined'。你是否需要并初始化Parse SDK? – Maroshii 2014-10-06 14:18:16
我在那里的长度> 0,只是把它拿出来的例子,它肯定在那里,因为我console.log -ed它:P而且我也三重检查是否我初始化了似乎一直罚款的解析SDK。 – 2014-10-06 15:15:01