Upload a photo file
Posted: Wed Apr 14, 2004 12:21 am
excuss my sloppness ive been staring at this for hours and cant figure it out, why it wont work
here is my form:
and here is the part to save the file
please help thanks, i swear if i look at this any longer im going to explode
here is my form:
Code: Select all
<?php
echo"
<table cellpadding=0 cellspacing=0 class=body>
<form enctype="multipart/form-data" action="?func=upload_listing" method="post">
<tr>
<td align=right class=header>
Upload Picture:
</td>
<td>
<input name="photo" type="file">
</td>
</tr>
<tr>
<td valign=bottom>
<input type=hidden name=id value=1>
</td>
<td valign=bottom>
<input type=submit name=submit value="Upload Photo">
</td>
</tr>
</form>
</table>";
?>Code: Select all
<?php
if (is_uploaded_file($_FILES['photo']['tmp_name'])){
$destanation = $_POST[id] . ".jpg";
move_uploaded_file($_FILES['photo']['tmp_name'], $destanation);
print "
<table width=100%>
<tr>
<td>
<center><b>your picture has been uploaded</b></center>
</td>
</tr>
</table>";
}
else{
print "
<table width=100%>
<tr>
<td>
<center><b>ERROR</b></center>
</td>
</tr>
</table>";
}
?>