Home > Backend Development > PHP Tutorial > Uploadify 上传图片后找不到文件

Uploadify 上传图片后找不到文件

WBOY
Release: 2016-06-20 12:31:54
Original
928 people have browsed it

谁用过Uploadify 使用官网的demo上传图片显示成功但是文件没有!!!

<!DOCTYPE HTML><html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>UploadiFive Test</title> <script src="jquery.min.js"></script><script src="jquery.uploadify.min.js" type="text/javascript"></script><link rel="stylesheet" type="text/css" href="uploadify.css"><style type="text/css">body {	font: 13px Arial, Helvetica, Sans-serif;}</style></head><body>	<h1>Uploadify Demo</h1>	<form>		<div id="queue"></div>		<input id="file_upload" name="file_upload" type="file" multiple="true">	</form>	<script type="text/javascript">		<?php $timestamp = time();?>		$(function() {			$('#file_upload').uploadify({				'formData'     : {					'timestamp' : '<?php echo $timestamp;?>',					'token'     : '<?php echo md5('unique_salt' . $timestamp);?>'				},				'swf'      : 'uploadify.swf',				'uploader' : 'uploadify.php'			});		});	</script></body></html>
Copy after login


<?php/*UploadifyCopyright (c) 2012 Reactive Apps, Ronnie GarciaReleased under the MIT License <http://www.opensource.org/licenses/mit-license.php> */// Define a destination$targetFolder = '/uploads'; // Relative to the root$verifyToken = md5('unique_salt' . $_POST['timestamp']);if (!empty($_FILES) && $_POST['token'] == $verifyToken) {	$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.';	}}?>
Copy after login


都是官网的demo,怎么弄也没有文件!!!!


回复讨论(解决方案)

//下面这句用的是根目录
$targetFolder = '/uploads';

问题解决了,和一楼说的差不多是因为目录设置到跟目录里了

直接把这一行改成你要的目录就行了

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template