Uploadify 在本地测试一切正常,但在服务器上出现问题

ahuyjv26 2011-06-24 12:10:52
<link href="uploadify/uploadify.css" type="text/css" rel="stylesheet" />
<script type="text/javascript" src="uploadify/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="uploadify/swfobject.js"></script>
<script type="text/javascript" src="uploadify/jquery.uploadify.v2.1.4.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#file_upload').uploadify({
'uploader' : 'uploadify/uploadify.swf?var='+(new Date()).getTime(),
'script' : 'uploadify/uploadify.php?PHPSESSID=<?php echo session_id();?>',
'cancelImg' : 'uploadify/cancel.png',
'fileDesc' : 'pdf/jpg/jpeg/bmp/gif/png/doc/xls/txt/rar/zip/',
'fileExt' : '*.jpg;*.pdf;*.bmp;*.gif;*.png;*.doc;*.xls;*.txt;*.rar;*.zip',
'folder' : '/uploadfile',
'auto' : true,
'removeCompleted' : false
}); });
</script>

在服务上uploadfile文件夹中见不到我上传的文件 此文件夹已经有写入的权限了 在本地电脑上测试一切正常


...全文
74 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
ahuyjv26 2011-06-25
  • 打赏
  • 举报
回复
谢谢 是路径的问题

if (!empty($_FILES)) {
$tempFile = $_FILES['Filedata']['tmp_name'];
$targetPath = $_SERVER['DOCUMENT_ROOT'] . $_REQUEST['folder'] . '/';
$name=$_FILES['Filedata']['name'];
$ext=file_exte($name);
$time1=date('Ymdhis');
$newname=$time1.".".$ext;
//$targetFile = str_replace('//','/',$targetPath) . $newname;
$targetFile ="./uploadfile/".$newname;
move_uploaded_file($tempFile,$targetFile);
echo str_replace($_SERVER['DOCUMENT_ROOT'],'',$targetFile);
$_SESSION['filedir']="./uploadfile/".$newname;
}


//$targetFile = str_replace('//','/',$targetPath) . $newname;
$targetFile ="./uploadfile/".$newname;

str_replace('//','/',$targetPath)获取不到路径,我直接给"./uploadfile/ 写上去就可以了
xuzuning 2011-06-24
  • 打赏
  • 举报
回复
你贴 js 代码有什么用!?
关键在于你 uploadify/uploadify.php 都得到了些什么

21,887

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧