全部, 我已經將JS文件包含在我需要的Wordpress主題中。然後,我創建了以下頁面:在本地主機上使用Uploadify和Wordpress - 不加載
<?php
$js_path_uploadify = ABSPATH."wp-content/uploadify.swf";
$js_path_script = ABSPATH."wp-content/uploadify.php";
$cancel_path = ABSPATH."wp-content/cancel.png";
$check_path = ABSPATH."wp-content/check.php";
$uploads_path = ABSPATH."wp-content/uploads";
?>
<script type="text/javascript">
$(document).ready(function() {
$('#custom_file_upload').uploadify({
'uploader' : '<?php echo $js_path_uploadify; ?>',
'script' : '<?php echo $js_path_script ; ?>',
'cancelImg' : '<?php echo $cancel_path; ?>',
'folder' : '<?php echo $uploads_path; ?>',
'auto' : false,
'multi' : true,
'fileExt' : '*.jpg;*.gif;*.png',
'fileDesc' : 'Image Files (.JPG, .GIF, .PNG)',
'buttonText': 'Add Files',
'checkScript': '<?php echo $check_path; ?>',
'displayData': 'speed',
'onComplete': function(a, b, c, d, e){ alert(d);},
'onAllComplete': function(event,data){
//something here
},
'onError': function(event,data){
//something here
}
});
$("#upload_files").click(function(){
alert("it is here");
$('#custom_file_upload').uploadifyUpload();
});
});
</script>
</head>
<body>
<div id="status-message">Select some files to upload:</div>
<input id="custom_file_upload" type="file" name="Filedata" />
<div id="error-message"></div>
<input type="button" id="upload_files" value="Upload Files">
當我做到這一點看起來不錯,但我得到以下錯誤,當我檢查我的console.log。錯誤是:
不允許加載本地資源:文件:/// d:/My%20Documentsxampphtdocs%0Bendor_wordpress/wp-content/uploadify.swf
對什麼是錯這個或如何任何想法要解決這個問題?
感謝