4

我希望 UploadCare 对话框在单击 MyButton 后打开,显示 Twitter 徽标,但事实并非如此。为什么不?

$('#MyButton').on('click', function() {
    uploadcare.openDialog('https://g.twimg.com/About_logoUsage.png');
    return false;
});
4

1 回答 1

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;
});
于 2014-12-23T12:25:43.383 回答