0
我試圖將多個文件上傳到使用parse.com數據庫:parse.com多個文件上傳失敗
function uploadPhotos() {
if (files != null)
{
var count =0;
for (var i=0;i<fileCnt;i++)
{
file = files[i];
var photoComment = comments[i];
var parseFile = new Parse.File("photo.jpg", file, "image/jpg");
parseFile.save().then(function() {
// The file has been saved to Parse.
BK_PHOTOS[i] = new Parse.Object("BK_PHOTOS");
BK_PHOTOS[i].set("bk_comment", photoComment);
BK_PHOTOS[i].set("bk_photo", parseFile);
BK_PHOTOS[i].save();
count++;
if(count == fileCnt)
{
saveObject();
}
}, function(error) {
// The file either could not be read, or could not be saved to Parse.
console.log("Error!");
});
這上傳同一個文件多次,即使files
數組包含不同的文件。