私は自分のサイトで Uploadify を使用しようとしており、次の uploadify.php でセットアップしています。
<?php
// Define a destination
//$targetFolder = '/uploads'; // Relative to the root
if (!empty($_FILES)) {
$tempFile = $_FILES['Filedata']['tmp_name'];
$targetPath = $_SERVER['DOCUMENT_ROOT'];
$targetFile = rtrim($targetPath,'/') . '/' . $_FILES['Filedata']['name'];
// Validate the file type
$fileTypes = array('jpg','jpeg','gif','png'); // File extensions
$fileParts = pathinfo($_FILES['Filedata']['name']);
if (in_array($fileParts['extension'],$fileTypes)) {
move_uploaded_file($tempFile,$targetFile);
echo '1';
} else {
echo 'Invalid file type.';
}
}
?>
アップロードしていなかったので、$targetFolder をコメントアウトし、$targetPath をドキュメント ルートになるように変更しました。これにより、Uploadify で file.txt をアップロードしようとすると、$targetFile が /home/user/public_html/example.com/file.txt になります。フォルダは 755 に設定されています。何が問題なのかわかりません。それ以外の場合、私は Uploadify のバニラ インストールを使用していますが、ファイルが実際にあるべき場所に移動しないことを除いて、すべて正常に動作しているようです。