Take a look at this code:
[CODE]<?
if (file_exists(“NOTE1)) {
echo “Sorry, that filename is taken. Please save it as another name and try again.”;
}
else
{
if(isset( $Submit ))
{
//If the Submitbutton was pressed do:
if ($_FILES[‘imagefile’][‘type’] == “image/gif”){
copy ($_FILES[‘imagefile’][‘tmp_name’], “files/”.$_FILES[‘imagefile’][‘name’])
or die (“Could not copy”);
echo “”;
echo “<br><b>Link for forums: </b>/files/”.$_FILES[‘imagefile’][‘name’].””;
echo “<br>Size: “.$_FILES[‘imagefile’][‘size’].””;
echo “Type: “.$_FILES[‘imagefile’][‘type’].””;
}
else {
echo “<br><br>”;
echo “Could Not Copy, Wrong Filetype (“.$_FILES[‘imagefile’][‘name’].”)<br>”;
}
}
}
?>
I have some things to ask people to change for me. line 2 If an image exists with the same filename i want the upload image to be given a random name. Can someone do this for me? Also how can i make it so i specify what filetypes can be uploaded, now it is if image/gif.
One last thing, in this part of the code:
[CODE]
echo “<br><b>Link for forums: </b>example.com/files/”.$_FILES[‘imagefile’][‘name’].””;
I want to put that so the url of the image is in a textbox, however it gives an error even if i use “
For example
[CODE]
echo “<br><b>Link for forums: </b><input type=”text” value=”example.com/files/”.$_FILES[‘imagefile’][‘name’]”>.””;
I would have thought that the above would be right.
One last thing. How can i add an image over the btm right corner of the image when its uploaded.