2014-12-23 18 views
4

我希望UploadCare对话框,单击myButton的,显示了Twitter的标志后打开,但事实并非如此。为什么不?UploadCare不加载图像对话框

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

回答

3

您必须通过一个file对象作为参数openDialog方法。

// 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; 
}); 
:您可以通过调用 uploadcare.fileFrom方法获取文件对象