我希望 UploadCare 对话框在单击 MyButton 后打开,显示 Twitter 徽标,但事实并非如此。为什么不?
$('#MyButton').on('click', function() {
uploadcare.openDialog('https://g.twimg.com/About_logoUsage.png');
return false;
});
我希望 UploadCare 对话框在单击 MyButton 后打开,显示 Twitter 徽标,但事实并非如此。为什么不?
$('#MyButton').on('click', function() {
uploadcare.openDialog('https://g.twimg.com/About_logoUsage.png');
return false;
});
您需要将file
对象作为参数传递给openDialog
方法。您可以通过调用uploadcare.fileFrom方法获取文件对象:
// Pre-load an image from arbitrary URL,
// and open Uploadcare file upload dialog
$('#MyButton').on('click', function() {
var file = uploadcare.fileFrom('url', 'https://g.twimg.com/About_logoUsage.png');
uploadcare.openDialog(file);
return false;
});