我希望在单击MyButton后打开UploadCare对话框,显示Twitter徽标,但事实并非如此。为什么不呢?
$('#MyButton').on('click', function() {
uploadcare.openDialog('https://g.twimg.com/About_logoUsage.png');
return false;
});
答案 0 :(得分:3)
您需要将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;
});