尝试使用javascript上传文件并将其保存到parse.com中的对象。
表单代码:
<input type="file" id="PhotoFileUpload" name="PhotoFileUpload">
JavaScript云代码:
var fileUploadControl = [];
fileUploadControl = req.body.PhotoFileUpload[0];
if (fileUploadControl.files[0].length > 0) {
var file = fileUploadControl.files[0];
var name = "photo.jpg";
var parseFile = new Parse.File(name, file);
parseFile.save();
我收到错误:
Result: TypeError: Cannot read property '0' of undefined
Line: if (fileUploadControl.files[0].length > 0) {
有什么想法吗?