gpt4 book ai didi

javascript - Cloudinary直接上传,带有上传预设和Meteor.js

转载 作者:行者123 更新时间:2023-12-01 02:29:15 29 4
gpt4 key购买 nike

所以我可以通过 http://cloudinary.com/blog/direct_upload_made_easy_from_browser_or_mobile_app_to_the_cloud#face_detection_based_thumbnail 中基于表单的方法将图像上传到 Cloudinary ,但是当我尝试增加现有文件输入时,它给我进度,说文件正在上传,但错误指出文件丢失。

{"error":{"message":"Missing required parameter - file"}}

js代码为:

Template.fileUpload.created = function () {
$.cloudinary.config({
cloud_name: "theCloudName"
})
};

Template.fileUpload.rendered = function () {
var fileUploadCallback = function(err, result){
if(err){
console.log("Error: " + err.reason);
}else{
console.log("Success: " + result);
}
};

$('input').unsigned_cloudinary_upload("discussionAdd", {
cloud_name: 'theCloudName',
tags: 'discussionAdd'
}, {
multiple: true
}).bind('cloudinarydone', function (e, data) {

$('.thumbnails').append($.cloudinary.image(data.result.public_id, {
format: 'jpg',
width: 150,
height: 100,
crop: 'thumb',
gravity: 'face',
effect: 'saturation:50'
}))
}
).bind('cloudinaryprogress', function (e, data) {
console.log("data loaded is : " + data.loaded + " data size: " + data.total);

$('.progress_bar').css('width',
Math.round((data.loaded * 100.0) / data.total) + '%');

});
};

标记是:

<template name="fileUpload">
<form class='upload_form'>
upload an image

<input type="file" class='upload_field cloudinary_fileupload'>
<div class="progress_bar" style='background-color: red, height: 20px'>
<div class='thumbnails'></div>
</div>
</form>
</template>

最佳答案

结果我在输入标记中缺少 name="file"属性。

关于javascript - Cloudinary直接上传,带有上传预设和Meteor.js,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25026086/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com