I've found some code that I'm trying out for a simple image upload. It doesn't seem to work maybe somebody can help me with it:
<form name="form1" method="post" action="" enctype="multipart/form-data">
<input type="file" name="imagefile">
<input type="submit" name="Submit" value="Submit">
<?php
if(isset( $Submit ))
{
//If the Submit button was pressed do:
if ($_FILES['imagefile']['type'] == "image/gif"){
//Check if the image type from the selected file is gif.
//If the type is gif then we want to copy it like this:
copy ($_FILES['imagefile']['tmp_name'], "uploads/".$_FILES['imagefile']['name'])
or die ("Could not copy");
echo "";
echo "Name: ".$_FILES['imagefile']['name']."";
echo "Size: ".$_FILES['imagefile']['size']."";
echo "Type: ".$_FILES['imagefile']['type']."";
echo "Copy Done....";
}
else
{
echo "";
echo "Could Not Copy, Wrong Filetype (".$_FILES['imagefile']['name'].")";
}
}
?>
</form>
This code gave me this error:
Warning: copy(test/logo.gif): failed to open stream: No such file or directory in /home/inmotion/domains/inmotionimports.ca/public_html/test/imageLoader3.php on line 23
Could not copy
Line 23 is the copy line.
Thanks