非常急,如能帮我.送100分!!

tianxueer 2003-10-04 12:29:28
我想要一个上传文件的php程序.
要求:
1.能一次上传多个文件.
2.上传文件时,如果有重名的,直接替换.
由于我不懂php.所以最好给我现成的.然后我直接上传就能用.如果不行也没关系,详细告诉我操作步骤也行.谢谢!
...全文
26 13 打赏 收藏 转发到动态 举报
写回复
用AI写文章
13 条回复
切换为时间正序
请发表友善的回复…
发表回复
tianxueer 2003-10-06
  • 打赏
  • 举报
回复
wanshun890@163.com
DeltaCat 2003-10-06
  • 打赏
  • 举报
回复
已经发给你了,里面有一个DEMO
你自己看吧
FTP类支持自定义上传的文件类型,大小,保存到的目录,重命名等,对文件个数没限制,不过要有服务器的可写权限
hxhlc 2003-10-05
  • 打赏
  • 举报
回复
昨天晚上想传一个,怎么不行?
DeltaCat 2003-10-05
  • 打赏
  • 举报
回复
留下你MAIL,我给你个多文件FTP上传类(偶自己写的,可能水平不高,不过绝对能用)
chenbinggan 2003-10-05
  • 打赏
  • 举报
回复
if($action1){
?>
<html>
<head>
<title>File Upload Results</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body bgcolor="#FFFFFF" text="#000000">
<p><font face="Arial, Helvetica, sans-serif"><font size="+1">File
Upload Results</font><br><br>

<?
set_time_limit(60);
// make reasonably sure the script does not time out on large files
$path1 = dirname($PATH_TRANSLATED)."/upload/";
//print $PATH_TRANSLATED;
//print $path1."<br>";
// assign our path in a form PHP for Windows understands

for($i=1;$i<3;$i++)
{
$temp1="file".$i;
$temp2="file".$i."_name";
$source=$$temp1;
$source_name=$$temp2;
// print $temp."=".$$temp."<br>";

//print $file1_name;
//print $file2_name;
//exit;

//*****************
//$source = $file1;
//$source_name = $file1_name;
print $source."<br>";
print $source_name;
//exit;
if(($source <> "none")&&($source <> ""))
{
// see if the file exists; non-existing file has name of "none"
if($error1 <> 1)
{
// no need to copy a file if directory not write-enabled
$dest = $path1.$source_name;
// append file name to our path

if(copy($source,$dest)){
// copy the file from the temp directory to the upload directory, and test for success
echo "$source has been uploaded<br>\n";
$imagesize = getimagesize($dest);
switch($imagesize[2])
{
case 0:
echo "<br> Image is a unknown <br>";
unlink($dest);
exit;
case 1:
echo "<br> Image is a GIF <br>";
echo "$dest has a width of $imagesize[0]<br>";
echo "$dest has a height of $imagesize[1]<br>";
$newname = $path1;
$newname .=$i.time() . ".gif";
if(copy($dest,$newname))
{
echo "<br> GIF Rename Successful from $dest to $newname";
}else {
echo "<br> GIF Rename Unsuccessful";
}
unlink ($dest);
break;
case 2:
echo "<br> Image is a JPG <br>";
echo "$dest has a width of $imagesize[0]<br>";
echo "$dest has a height of $imagesize[1]<br>";
$newname = $path1;
$newname .=$i.time() . ".jpg";
if(copy($dest,$newname))
{
echo "<br> JPG Rename Successful from $dest to $newname";
}else {
echo "<br> JPG Rename Unsuccessful";
}
unlink ($dest);
break;
case 3:
echo "<br> Image is a PNG <br>";
echo "$dest has a width of $imagesize[0]<br>";
echo "$dest has a height of $imagesize[1]<br>";
$newname = $path1;
$newname .=time() . ".png";
if(copy($dest,$newname))
{
echo "<br> PNG Rename Successful from $dest to $newname";
}else {
echo "<br> PNG Rename Unsuccessful";
}
unlink ($dest);
break;
}
}else {
echo "Upload directory not write-enabled\n";
// you need to write-enable the upload directory
$error1 = 1; // set flag
}
}
unlink($source);
// delete the file from the temp directory
}

?>
<image src="upload/<? print basename($newname)?>">
<?
} //end for
?>
<br><a href="fup.php">Back</a>
</font></p>
</body>
</html>

<?
}
else {

?>

<html>
<head>
<title>File Upload</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body bgcolor="#FFFFFF" text="#000000">
<p><font face="Arial, Helvetica, sans-serif"><font size="+1">File
Upload</font><br><br>
If your browser is upload-enabled, you will see "Browse"
(Netscape, Internet Explorer) or ". . ." (Opera) buttons below.
Use them to select file(s) to upload, then click the "Upload"
button. After the files have been uploaded, you will see a results screen.<br>
<form method="post" enctype="multipart/form-data" action="fup.php">
<input type="hidden" name="MAX_FILE_SIZE" value="800000">
<input type="hidden" name="action1" value="1">
File 1: <input type="file" name="file1" size="30"><br>
File 2: <input type="file" name="file2" size="30"><br>
<br>
<input type="submit" value="Upload">
</form>
</font></p>
</body>
</html>

<?

}

?>
feel8 2003-10-05
  • 打赏
  • 举报
回复
用ftp软件可以改,选择需要改的文件夹在远端窗口,右击,拿cuteftp来说,有属性选项,可以改为777
tianxueer 2003-10-05
  • 打赏
  • 举报
回复
先谢谢大家, 但我现在发现一个问题. 我不是服务器的管理员,不能把上传目录的属性更改为777.
请问还能上传吗?
tianxueer 2003-10-04
  • 打赏
  • 举报
回复
搜出来的都不能用,不是乱码,就是不成功.
luok 2003-10-04
  • 打赏
  • 举报
回复
搜一下呢,很多呀,
w8c 2003-10-04
  • 打赏
  • 举报
回复
http://www.w8c.com/gb/images/php19a.zip

这是老版本的,但能满足你的功能
新版本正在测试中,功能更强大,全面支持ZIP,TAR,GZ,TGZ文件的解压缩
forest is the name 2003-10-04
  • 打赏
  • 举报
回复
做网站开发就不要怕学习,Script和Object的灵活性使开发变的容易,但是同时也程序的变化增加,一个开发好的程序到另外一台计算机上就可能不能运行。

如果你已经找到了一个别人可以使用的程序,而在自己的计算机上不能使用,那么你还是应该静下心来把程序完整地看一遍,一般情况下,只要做非常小的改动就可以使用。
maxid 2003-10-04
  • 打赏
  • 举报
回复
http://www.phpe.net/class/88.shtml
你要用就要看看源文件,里面有个例子的,不会PHP就要学嘛,到少要看得懂一点
tommycpma 2003-10-04
  • 打赏
  • 举报
回复
能一次上传多个文件????
可能实现吗?

21,891

社区成员

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

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