這些天我正在設計一個文件上傳系統。 我想上傳圖片到服務器並將文件路徑存儲在MySQL數據庫中。 保存文件路徑後,用戶會在網址被重定向回上傳頁面與用戶字符串uid=1
上傳文件,插入文件路徑到MySQL並返回到URL中的字符串上傳頁面
upload.php的
<form action="<?php echo "upload_file.php?id=" . $cid ; ?>" method="post" enctype="multipart/form-data" name="photo" id="photo">
<table width="295" border="0" align="center">
<tr>
<td width="289">Photos</td>
</tr>
<tr>
<td class="formdisplay"><label for="priestname"></label>
<label for="photo"></label>
<input type="file" name="file" id="file" /></td>
</tr>
<tr>
<td class="formdisplay"><input type="submit" name="submit" id="submit" value="Submit" /></td>
</tr>
</table>
</form>
$cid
是利用URL檢索用戶ID的變量GET [upload.php?id=1]
並幫我創建upload_file.php文件。
你想我們爲你寫整個文件嗎? http://www.w3schools.com/php/php_file_upload.asp – Justinas
如果任何答案的工作公平並接受它......如果不是,問。 –