我希望单击MyButton后会打开UploadCare对话框,显示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;
});
关于javascript - UploadCare不会在对话框中加载图像,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/27613480/