谁用过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><?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.'; }}?>
//下面这句用的是根目录
$targetFolder = '/uploads';
问题解决了,和一楼说的差不多是因为目录设置到跟目录里了
直接把这一行改成你要的目录就行了
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号