1
簽名,這是我對通過插件cloudinary上傳代碼,不幸的是我得到的上傳錯誤......我工作在本地主機上,並在放置該代碼的頁面是add.php頁面Cloudinary如何生成PHP
<script src="//widget.cloudinary.com/global/all.js" type="text/javascript"></script>
<script type="text/javascript">
var generateSignature = function(callback, params_to_sign){
$.ajax({
url : "http://localhost/add.php?public_id=sample_image×tamp=1315060510",
type : "GET",
dataType: "text",
data : { data: params_to_sign},
complete: function() {console.log("complete")},
success : function(signature, textStatus, xhr) { callback(signature); },
error : function(xhr, status, error) { console.log(xhr, status, error); }
});
}
</script>
<script type="text/javascript">
$('#upload_widget_opener').cloudinary_upload_widget(
{ cloud_name: 'dammiunparere', api_key: '189XXXX42445355',
upload_signature: generateSignature},
function(error, result) { console.log(error, result) });
</script>
這是您看到的「無效簽名」錯誤嗎?除了'params_to_sign',我發現你在'url'中傳遞了一些查詢字符串參數。請注意,Cloudinary希望您僅簽署**「params_to_sign」中的內容。 –