嘿我使用mvc3敲门并尝试使用敲除绑定上传并将上传的图像保存在数据库中.我能够浏览并获取图像,但没有得到如何保存该图像.我的HTML视图是:
<div data-bind="foreach: { data: images, beforeRemove: beforeRemoveSlot }">
<div>
<input type="file" accept="image/*" data-bind="file: imageFile, fileObjectURL: imageObjectURL, fileBinaryData: imageBinary"/>
<div data-bind="if: imageObjectURL">
<img class="thumb" data-bind="attr: { src: imageObjectURL }"/>
</div>
<div>Size: <span data-bind="text: fileSize"></span> bytes</div>
</div>
</div>
<input type="submit" value="Upload Picture" data-bind="click: upload" />
Run Code Online (Sandbox Code Playgroud)
我的观点模型是:
var windowURL = window.URL || window.webkitURL;
ko.bindingHandlers.file = {
init: function (element, valueAccessor) {
$(element).change(function () {
var file = this.files[0];
if (ko.isObservable(valueAccessor())) {
valueAccessor()(file);
}
});
},
update: function (element, valueAccessor, allBindingsAccessor) {
var file …Run Code Online (Sandbox Code Playgroud) 在我的Web应用程序中,我允许用户使用API客户端库中的auth命令登录,但我找不到Google API JavaScript客户端库的Logout选项.
任何人都可以建议我如何退出我的应用程序以及谷歌帐户?
我的登录代码是:
var OAUTHURL = 'https://accounts.google.com/o/oauth2/auth?';
var VALIDURL = 'https://www.googleapis.com/oauth2/v1/tokeninfo?access_token=';
var SCOPE = 'https://www.googleapis.com/auth/userinfo.profile';
var CLIENTID = googleAPI;
var REDIRECT = redirectUrl;
var TYPE = 'token';
var _url = OAUTHURL + 'scope=' + SCOPE + '&client_id=' + CLIENTID + '&redirect_uri=' + REDIRECT + '&response_type=' + TYPE;
var acToken;
var tokenType;
var expiresIn;
var user;
$('#googleLogin').click(function(){
var win = window.open(_url, "windowname1", 'width=800, height=600');
var pollTimer = window.setInterval(function () {
if (win.document.URL.indexOf(REDIRECT) != -1) {
window.clearInterval(pollTimer);
var url = …Run Code Online (Sandbox Code Playgroud)