2
我建立一個註冊表格,並在那裏,有申請的用戶圖像現在parse.com與Java的腳本 - 上傳圖像的用戶,並顯示圖像
<input type="file" name="img1" id="img1">
,當用戶按下按鈕「註冊「我稱之爲函數註冊:
function signUp(){
var username = document.getElementById('username_signUp').value;
var password = document.getElementById('password_signUp').value;
Parse.initialize("kkbFC-----dldRYvUOywO8", "2ux4CkBgv4QB---wNguk");
var user = new Parse.User();
user.set("username", username);
user.set("email", username);
user.set("password", password);
var fileUploadControl = $("#img1")[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) {
alert("Error: " + error.code + " " + error.message);
// The file either could not be read, or could not be saved to Parse.
});
user.set("image", file);
}
user.signUp(null, {
success: function (user) {
},
error: function (user, error) {
}
});
}
signUp完成,我得到parse.com上的新行。 在「圖像」提起我HABE
{"lastModifiedDate":{"__type":"Date","iso":"2014-01-18T20:07:11.000Z"},"name":"empty-f.gif","size":2498,"type":"image/gif","webkitRelativePath":""}
,如果它是好還是不好,我不undersatd,但是當我試圖讓圖像 - 這似乎是undfined。
alert(profilePhoto.url); ->It show me the message "undefined"
謝謝!
我還沒有測試過它。它不起作用,讓我知道。 – ahoffer