Upload script wont recognized file?

Before I changed host this script worked fine.

Infact it still works fine on my old host even though its the same script?

I am so confused with this, Please help?

It keeps coming back with the error its not an image file

[PHP]<?php

include ($_SERVER[‘DOCUMENT_ROOT’].’/slorg/header.inc.php’);

$pagetitle = “Upload”;
$helpfaerie = mysql_fetch_array(mysql_query(“SELECT * FROM helpfaerie WHERE page = ‘upload’”));
$helpfaerie2 = mysql_fetch_array(mysql_query(“SELECT * FROM staff WHERE username = ‘$username’”));

if ($helpfaerie2[helpfaerie] == 1)
{
echo "<div id=“helpfaerie” style="overflow: auto; position:fixed; bottom:0; right:0; "><table width=“200” border=“0” cellspacing=“0” cellpadding=“4” style=“border-top: 1pt solid black;border-bottom: 1pt solid black;border-left: 1pt solid black;border-right: 1pt solid black; background-color:#ffffff;”>

$helpfaerie[text]

[x] "; }

ECHO <<<END

<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
Upload An Image
Name of Graphic: <input type="text" name="name"
Filed Under:
            <option "avatars">Avatar</option>
    <option "backgrounds">Background</option>
            <option "banners">Banner</option>
    <option "blinkies">Blinkie</option>
    <option "buttons">Button</option>
    <option "gallerys">Gallery Layout</option>
    <option "glitters">Glitter</option>
    <option "guides">Guide Image</option>
   <option "guilds">Guild Layout</option>
    <option "misc"> Miscellaneous</option>
    <option "nbhelp>NeoBoard Help</option>
    <option "petlookups">Pet Lookup</option>
    <option "petpages">PetPage Layout</option>
    <option "shields">Shield</option>
    <option "shops">Shop Layout</option>
     <option "tutorials">Tutorial Image</option>
    <option "userlookups">User Lookup</option>

</select">

Upload Image:

 

END;

?>[/PHP]

Then the 2nd page

[PHP]<?php

include ($_SERVER[‘DOCUMENT_ROOT’].’/slorg/addon.php’);

include ($_SERVER[‘DOCUMENT_ROOT’].’/dblink.php’);

$pagetitle = “Upload”;

$name = $_POST[‘name’];
$filedunder = $_POST[‘filedunder’];
$filedunder2 = $filedunder.‘img’;
$Image = $_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(“image/”, $_FILES[‘Image’][‘type’]))
{
die(header(“Location: $baseurl/slorg/upload.php?error=Please+only+use+image+files.”));
}
if ((!$name) OR (!$filedunder) OR (!$Image))
{
die(header(“Location: $baseurl/slorg/upload.php?error=Please+do+not+leave+any+info+blank.”));
}
else
{
mysql_query(“INSERT INTO $filedunder2 (madeby,name,date,submitted) VALUES (’$username’,’$name’,’$timestamp’,’$username’)”);
$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 = $_FILES[‘Image’][‘tmp_name’];
$dest = $_SERVER[‘DOCUMENT_ROOT’].’/images/’.$filedunder.’/’.$insert_id.‘img.png’;
copy($file, $dest);
header(“Location: upload.php?error=Your+graphic+has+been+added!”);
}

?>
[/PHP]

Best Guess is two different versions of PHP. Most likely version 4 vs version 5… If you run this code through a syntax checker I bet if finds the issue right away. But I would verify php versions first. If your “old” host is using a different version than your new host you have found the issue.

Try these for starters might help but might not.
eregi is being depreciated so might be to do with that.
Where it gives you the error does it give you which line or anything else in the error message?

missing a greater than sign
[php]<input type=“text” name=“name”[/php]

missing a quote
[php]<option "nbhelp>NeoBoard Help [/php]

should not have a quote
[php]</select"> [/php]

Your right! Thank you

Sorry its not a PHP error Im getting,

Where in my code it says die header and then I have a written an error message there, Thats the error message which comes back.

So this comes back I guess the !eregi (Please+only+use+image+files).

[php]if (!eregi(“image/”, $_FILES[‘Image’][‘type’])){
die(header(“Location: $baseurl/slorg/upload.php?error=Please+only+use+image+files.”));
}
if ((!$name) OR (!$filedunder) OR (!$Image)){
die(header(“Location: $baseurl/slorg/upload.php?error=Please+do+not+leave+any+info+blank.”));
}[/php]

So you want to find image/ print out the array first and tell me what the result is of the printout to screen might be at the top of the screen.
[php]print_r($_FILES[‘Image’][‘type’]);[/php]

Sorry, Im totally confused.

Do I replace the code something with [php]print_r($_FILES[‘Image’][‘type’]);[/php] or Do I add it to the page?

opps

http://www.staff.spardel.com/upload.php?error=Please+do+not+leave+any+info+blank.

Is the error it comes back as

Sponsor our Newsletter | Privacy Policy | Terms of Service