Tuesday, February 15, 2011

PHP/MySql : Store file path or name in database, file in folder.

Create a file : form.html

<form action=addmembers.php method=post enctype="multipart/form-data">
<table border="0" cellspacing="0" align=center cellpadding="3" bordercolor="#cccccc">
<tr>
<td>File:</td>
<td><input type="file" name="filep" size=45></td>
</tr>
<tr>
<td colspan=2><p align=center>
<input type=submit name=action value="Load">
</td>
</tr>
</table>
</form>


Create another file : addmembers.php
<?

if ($_POST["action"] == "Load")
{
$folder = "images/";