View Single Post
Old 02-09-2003, 05:44 PM   #1 (permalink)
trevor
Code Monkey
 
Join Date: Jan 2003
Location: Canada
Posts: 91
trevor is on a distinguished road
trouble with some image upload code

Hi,

So I got this codefrom phpfreaks.com, and it is supposed to work fine, it works for everyone else.
anyways what it is supposed to do is upload a gif to files/ but instead it just clears the text box. thats it. nothin is uploaded, no errors, just basically like a reset button.

i think the code is fine but here it is anyways:

PHP Code:
<form name="form1" method="post" action="" enctype="multipart/form-data">
<input type="file" name="imagefile">

<input type="submit" name="Submit" value="Submit">

<?
if(isset( $Submit ))
{

if (
$_FILES['imagefile']['type'] == "image/gif"){

    
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 
"";
            echo 
"Could Not Copy, Wrong Filetype (".$_FILES['imagefile']['name'].")";
        }
}
?> </form>
anyways, could it be a problem with php.ini (i've been having a lot of trouble with that lately, lots of stuff turned off) or some other php/apache configuration file?

ideas?

thanks all!
trevor is offline   Reply With Quote