1
上傳的文件我有一個服務器上的文件上傳此代碼:如何讀取從XAMPP
<tr>
<td>
<form enctype="multipart/form-data" action="uploadaction.php" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="100000" />
</td>
</tr>
<tr>
<td>
Select the image: <input name="uploadedfile" type="file" />
</td>
<tr>
<td>
<input type="submit" value="Upload File" />
</form>
</td>
</tr>
而這裏的操作形式:
<?php
$target_path = "uploads/";
$target_path = $target_path . basename($_FILES['uploadedfile']['name']);
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
echo "The file ". basename($_FILES['uploadedfile']['name']).
" has been uploaded";
} else{
echo "There was an error uploading the file, please try again!";
}
?>
我會用什麼PHP函數? 你能給我一個關於如何讀取文件並將其顯示在瀏覽器中的例子嗎? 請幫忙,謝謝。
*(參考)* http://de.php.net/manual/en/features.file-upload.php – Gordon 2010-05-11 11:14:43
如果文件上傳成功,它應該位於您發送給它的目錄中。從那裏你如何選擇顯示它的種類取決於文件是什麼。 – 2010-05-11 20:22:00
它是一個圖像文件,我如何從瀏覽器中查看它? – user225269 2010-05-12 02:32:45