form is:
Spoiler
<FORM ACTION="upload.pro.php" enctype="multipart/form-data" METHOD=POST>
<table width="366" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="2"><center>Upload An Image</center></td>
</tr>
<tr>
<td>Made By:</td>
<td><input type="text" name="madeby" value="<? echo $check["username"] ?>"></td>
</tr>
<tr>
<td>You are?:</td>
<td><input type="text" name="submitted" value="<? echo $check["username"] ?>"></td>
</tr>
<tr>
<td>Name of Graphic:</td>
<td><input type="text" name="name" value=""></td>
</tr>
<tr>
<td>Filed Under:</td>
<td><select name="filedunder">
<option value="avatars">Avatar</option>
<option value=backgrounds>Background</option>
<option value=banners>Banner</option>
<option value=blinkies>Blinkie</option>
<option value=buttons>Button</option>
<option value=gallerys>Gallery Layout</option>
<option value=glitters>Glitter</option>
<option value=guides>Guide Image</option>
<option value=guilds>Guild Layout</option>
<option value=misc> Miscellaneous</option>
<option value=nbhelp>NeoBoard Help</option>
<option value=petlookups>Pet Lookup</option>
<option value=petpages>PetPage Layout</option>
<option value=shields>Shield</option>
<option value=shops>Shop Layout</option>
<option value=tutorials>Tutorial Image</option>
<option value=userlookups>User Lookup</option>
</select></td>
</tr>
<tr>
<td>Upload Image:</td>
<td><input type="file" name="Image"></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td colspan="2"><center><font size="-1"><i>
<input type="submit" name="Submit" value="Add">
</i></font></center></td>
</tr>
</table></FORM>
<FORM ACTION="upload.pro.php" enctype="multipart/form-data" METHOD=POST>
<table width="366" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="2"><center>Upload An Image</center></td>
</tr>
<tr>
<td>Made By:</td>
<td><input type="text" name="madeby" value="<? echo $check["username"] ?>"></td>
</tr>
<tr>
<td>You are?:</td>
<td><input type="text" name="submitted" value="<? echo $check["username"] ?>"></td>
</tr>
<tr>
<td>Name of Graphic:</td>
<td><input type="text" name="name" value=""></td>
</tr>
<tr>
<td>Filed Under:</td>
<td><select name="filedunder">
<option value="avatars">Avatar</option>
<option value=backgrounds>Background</option>
<option value=banners>Banner</option>
<option value=blinkies>Blinkie</option>
<option value=buttons>Button</option>
<option value=gallerys>Gallery Layout</option>
<option value=glitters>Glitter</option>
<option value=guides>Guide Image</option>
<option value=guilds>Guild Layout</option>
<option value=misc> Miscellaneous</option>
<option value=nbhelp>NeoBoard Help</option>
<option value=petlookups>Pet Lookup</option>
<option value=petpages>PetPage Layout</option>
<option value=shields>Shield</option>
<option value=shops>Shop Layout</option>
<option value=tutorials>Tutorial Image</option>
<option value=userlookups>User Lookup</option>
</select></td>
</tr>
<tr>
<td>Upload Image:</td>
<td><input type="file" name="Image"></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td colspan="2"><center><font size="-1"><i>
<input type="submit" name="Submit" value="Add">
</i></font></center></td>
</tr>
</table></FORM>
then the action page is
Spoiler
$name = $_POST['name'];
$madeby = $_POST['madeby'];
$submitted = $_POST['submitted'];
$filedunder = $_POST['filedunder'];
$filedunder2 = $filedunder.'img';
$Image = $HTTP_POST_FILES['Image'];
$directoryName = "$baseurl/images/$filedunder";
if (!file_exists($directoryName)) { mkdir($directoryName, 0777); }
$directoryName2 = "$baseurl/images/$filedunder";
if (!file_exists($directoryName2)) { mkdir($directoryName2, 0777); }
if (!eregi("$images/", $HTTP_POST_FILES['Image']['type']) )
{
die("
Please only use image files");
}
if ((!$name) OR (!$filedunder) OR (!$Image))
{
die("Please dont leave blank info");
}
else
{
mysql_query("INSERT INTO $filedunder2 (madeby,name,date,submitted) VALUES ('$madeby','$name','$timestamp','$submitted')");
$insert_id = mysql_insert_id();
$image = $insert_id . "img.png";
mysql_query("UPDATE $filedunder2 SET url = '$baseurl/images/$filedunder/$image' WHERE id = '$insert_id' ");
$file = $HTTP_POST_FILES['Image']['tmp_name'];
$dest = $_SERVER['DOCUMENT_ROOT'].'/images/'.$filedunder.'/'.$insert_id.'img.png';
copy($file, $dest);
die("oooohhhhh It Added!
<P>
<B>Take note of this url, as Your uploads page is currently down!!!</b><P>
<Textarea>www.spardel.com/images/$filedunder/$image</Textarea>
");
}
$name = $_POST['name'];
$madeby = $_POST['madeby'];
$submitted = $_POST['submitted'];
$filedunder = $_POST['filedunder'];
$filedunder2 = $filedunder.'img';
$Image = $HTTP_POST_FILES['Image'];
$directoryName = "$baseurl/images/$filedunder";
if (!file_exists($directoryName)) { mkdir($directoryName, 0777); }
$directoryName2 = "$baseurl/images/$filedunder";
if (!file_exists($directoryName2)) { mkdir($directoryName2, 0777); }
if (!eregi("$images/", $HTTP_POST_FILES['Image']['type']) )
{
die("
Please only use image files");
}
if ((!$name) OR (!$filedunder) OR (!$Image))
{
die("Please dont leave blank info");
}
else
{
mysql_query("INSERT INTO $filedunder2 (madeby,name,date,submitted) VALUES ('$madeby','$name','$timestamp','$submitted')");
$insert_id = mysql_insert_id();
$image = $insert_id . "img.png";
mysql_query("UPDATE $filedunder2 SET url = '$baseurl/images/$filedunder/$image' WHERE id = '$insert_id' ");
$file = $HTTP_POST_FILES['Image']['tmp_name'];
$dest = $_SERVER['DOCUMENT_ROOT'].'/images/'.$filedunder.'/'.$insert_id.'img.png';
copy($file, $dest);
die("oooohhhhh It Added!
<P>
<B>Take note of this url, as Your uploads page is currently down!!!</b><P>
<Textarea>www.spardel.com/images/$filedunder/$image</Textarea>
");
}
I dont know if it matters but, the form is on a subdomain and then upload directory is off the sub-domain
$baseurl = "http://www.spardel.com/";
Once I upload an image I get "Please only use image files"
Edited by Bubblychaz, 15 November 2012 - 07:43 PM.












