I have set it up for jpeg files only right now. what im trying to get this code to do is allow the user to upload jpegs, gifs, bitmaps to a specific folder on my server called applicantsImages. I am thinking the most logical way to get jpegs as well as gifs and bitmaps would be to use cases as I saw in others code, but I am a little unsure how to change what i have which is if statements to cases. also im not sure how to designate the server folder they will end up in. Right now the site when run on the remote server keeps telling me: "Could not copy" , here is the php code i have created thus far:
CODE
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<form name="form1" method="post" action="" enctype="multipart/form-data">
<input type="file" name="imagefile">
<br>
<input type="submit" name="Submit" value="Submit">
<?
if(isset( $Submit ))
{
//If the Submitbutton was pressed do:
if ($_FILES['imagefile']['type'] == "image/jpeg"){
copy ($_FILES['imagefile']['tmp_name'], "files/".$_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 "<br><br>";
echo "Could Not Copy, Wrong Filetype (".$_FILES['imagefile']['name'].")<br>";
}
}
?> </form>
</body>
</html>
[mod edit]Use the code tags!