我正在使用uploadify,尽管它可以正常工作,但它不会上传到文件夹中。我怎样才能让它复制?文件夹是 777。
如果需要,这是页面:
http://www.dilyurdu.com/uploadify/
// 脚本
$(function() {
$("#file_upload_1").uploadify({
height : 30,
swf : 'uploadify.swf',
uploader : 'uploadify.php',
width : 120
});
});
//php
$targetFolder = '/uploads'; // Relative to the root
if (!empty($_FILES)) {
$tempFile = $_FILES['Filedata']['tmp_name'];
$targetPath = $_SERVER['DOCUMENT_ROOT'] . $targetFolder;
$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.';
}
}