Php uploadify显示上载成功,文件夹中没有文件
我读过之前所有关于uploadify的帖子,都说上传成功,但没有上传文件,没有一个解决方案有效。有人能看一下代码,看看我是否遗漏了什么。我还运行了一个phpinfo(),它说我的文件上传已打开。我正在使用Uploadify3.1Php uploadify显示上载成功,文件夹中没有文件,php,jquery,file-upload,Php,Jquery,File Upload,我读过之前所有关于uploadify的帖子,都说上传成功,但没有上传文件,没有一个解决方案有效。有人能看一下代码,看看我是否遗漏了什么。我还运行了一个phpinfo(),它说我的文件上传已打开。我正在使用Uploadify3.1 <!DOCTYPE html> <html> <head> <title>My Uploadify Implementation</title> <link rel="stylesheet
<!DOCTYPE html>
<html>
<head>
<title>My Uploadify Implementation</title>
<link rel="stylesheet" type="text/css" href="uploadify.css">
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="jquery.uploadify-3.1.min.js"></script>
<script type="text/javascript">
$(function() {
$('#file_upload').uploadify({
'swf' : 'uploadify.swf',
'uploader' : 'uploadify.php'
// Your options here
});
});
</script>
</head>
<body>
<input type="file" name="file_upload" id="file_upload" />
</body>
</html>
$\u FILES['file\u upload']['tmp\u name']
而不是$\u FILES['Filedata']['tmp\u name']
只是尝试了同样的结果。别的?我的php有问题吗?目标路径正确并且有权限吗?我将权限设置为full。“uploads”文件夹与所有其他文件一起位于根文件夹中。是否有办法运行测试,查看uploadify.php是否正在执行?
// Define a destination
$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.';
}
}
?>