[請益] 關於php檔案上傳的問題
您好,我是php新手
請各位高手幫我看看是哪裡出問題,謝謝
-----------------upload2.php---------------------
<?
$file_name = $_FILES['file']['name'];
$file_tmp = $_FILES['file']['tmp_name'];
$chkfile=array(".php3",".php",".inc")
for($j=0;$j<count($chkfile);$j++){
if(strstr($file_name,$chkfile[$j])){
echo"<Script>alert('$file_name \\r\\r無法上傳,檔案格式不符!');history.go(-1);</Script>";
exit;}}
if (is_uploaded_file($file_tmp)) {
copy($file_tmp,"file/".$file_name);}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=big5">
<title>cid-12th</title>
<style type="text/css">
<!--
.style8 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; color: #555555; }
.style9 {color: #555555}
-->
</style>
</head>
<body>
<div align="center">
<table border="0" cellspacing="5" cellpadding="0">
<tr>
<td width="91"><span class="style8">投稿類別</span></td>
<td width="295"><?php echo $_POST['item']; ?></td>
</tr>
<tr>
<td><span class="style8">聯絡人email</span></td>
<td><?php echo $_POST['mailadd']; ?></td>
</tr>
<tr>
<td><span class="style8">論文</span></td>
<td><a href=<?php echo"file/".$file_name; ?> target=_blank><?php echo $file_name?></a></td>
</tr>
</table>
</div>
</body>
</html>
------------------------------------------------------
我是看這個教學跟著做的
可是似乎不太能用
http://www.fg.tp.edu.tw/~janet/fanglan/download/file/dreamweaverMX5.pdf
請高手們指證 謝謝
我跟著寫好的程式http://www.nknu.edu.tw/%7Edesign/php/fileupload.php
謝謝 大感謝
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.127.39.48
PHP 近期熱門文章
PTT數位生活區 即時熱門文章