Re: How To Upload
| From: | Jonathan Underfoot | Date: | Fri, 08 Feb 2002 20:28:15 +0000 |
| Subject: | Re: How To Upload | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-16734@lists.php.net to get a copy of this message | ||
Heres a form and the PHP behind it I use:
<---FORM--->
<HTML>
<HEAD>
<TITLE>Add Pic</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF"
VLINK="#800080">
<form enctype="multipart/form-data" action="addpic.php"
method="post">
<input type="hidden" value="$com_num" name="com_num">
Pic to Upload(Only .jpg and .gif files)
<p><input name="userfile" type="file">
<input type="submit" value="Send File">
</form>
</BODY>
</HTML>
<---PHP FILE--->
<?PHP
if (is_uploaded_file($userfile)) {
copy($userfile, "location/filename.xxx");
}} else {
echo "That diddn't work!";
}
header ("Location: http://www.underfoot.cc/");
?>
I do much more with it (resize and edit images etc etc) but thats the basic layout...
-Jonathan