最近、自分のサイトhttp://tradersprinting.com/contact/send-file-2/にuploadifiveをインストールしましたが、ファイルをアップロードしようとするたびに404エラーが発生します。
このサイトはWordPressコンテンツ管理システムを利用しており、1&1でホストされています。uploadifyファイルは、「http://tradersprinting.com/wp-content/themes/traders/uploadify」ディレクトリに保存されます。WordPress関数「bloginfo('template_directory')」は「http://tradersprinting.com/wp-content/themes/traders/」を返します。現在、すべてが調整なしで「工場出荷時の設定」になっています。以下に添付するコードのスニペットを保存してください。
ページ上のコードhttp://tradersprinting.com/contact/send-file-2/
<?php
chmod("wp-content/themes/traders/uploads/",0777);
chmod("wp-content/themes/traders/uploadify/uploads/",0777);
?>
<script src="<?php bloginfo('template_directory'); ?>/uploadify/jquery.min.js" type="text/javascript">
</script>
<script src="<?php bloginfo('template_directory'); ?>/uploadify/jquery.uploadifive.min.js" type="text/javascript">
</script>
<link rel="stylesheet" type="text/css" href="<?php bloginfo('template_directory'); ?>/uploadify/uploadifive.css">
<style type="text/css">
body {
font: 13px Arial, Helvetica, Sans-serif;
}
.uploadifive-button {
float: left;
margin-right: 10px;
}
#queue {
border: 1px solid #E5E5E5;
height: 177px;
overflow: auto;
margin-bottom: 10px;
padding: 0 3px 3px;
width: 300px;
}
</style>
<form>
<div id="queue">
</div>
<input id="file_upload" name="file_upload" type="file" multiple="true">
<a style="position: relative; top: 8px;" href="javascript:$('#file_upload').uploadifive('upload')">Upload Files</a>
</form>
<script type="text/javascript">
<?php $timestamp = time();?>
$(function() {
$('#file_upload').uploadifive({
'auto' : false,
'checkScript' : 'check-exists.php',
'formData' : {
'timestamp' : '<?php echo $timestamp;?>',
'token' : '<?php echo md5('unique_salt' . $timestamp);?>'
},
'queueID' : 'queue',
'uploadScript' : 'uploadifive.php',
'onUploadComplete' : function(file, data) { console.log(data); }
});
});
</script>
uploadifive.phpの私のコピー
<?php
/*
UploadiFive
Copyright (c) 2012 Reactive Apps, Ronnie Garcia
*/
// Set the uplaod directory
$uploadDir = '/uploads/';
// Set the allowed file extensions
$fileTypes = array('jpg', 'jpeg', 'gif', 'png'); // Allowed file extensions
$verifyToken = md5('unique_salt' . $_POST['timestamp']);
if (!empty($_FILES) && $_POST['token'] == $verifyToken) {
$tempFile = $_FILES['Filedata']['tmp_name'];
// Commenting out this line as a potential bugfix for 404 error
//$uploadDir = $_SERVER['DOCUMENT_ROOT'] . $uploadDir;
$uploadDir = "/wp-content/themes/traders/uploadify/uploads";
$targetFile = $uploadDir . $_FILES['Filedata']['name'];
// Validate the filetype
$fileParts = pathinfo($_FILES['Filedata']['name']);
if (in_array(strtolower($fileParts['extension']), $fileTypes)) {
// Save the file
move_uploaded_file($tempFile, $targetFile);
echo 1;
} else {
// The file type wasn't allowed
echo 'Invalid file type.';
}
}
?>
ルートから始まり、サンプルのuploadifyディレクトリに至るまでのすべてのステップに1つずつ含む、ディレクトリツリーのすべてのブランチに「uploads」ディレクトリを作成しましたが、ファイルを受信するものはありません。
私はこのプログラムが大好きで、デザイナーは素晴らしい仕事をしたと思いますが、特に投資した後は、この製品が機能することを本当に望んでいます。助けてください!