Forum Moderators: coopster

Message Too Old, No Replies

photo upload problem

everything is fine still cant upload images

         

phparion

7:32 am on Nov 13, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Hi

I have written a simple file upload code. I have double check the the URL of the upload folder etc are correct but still photos are not uploaded, when i use is_uploaded_file function it gives me error , here is the code ...

PHP Code:
move_uploaded_file($hname,$_SERVER['DOCUMENT_ROOT']."/images/".$newname.$p_type);

//all the variables in the above function have correct values i
//have checked it by printing them

if (is_uploaded_file($_FILES['photo']['tmp_name'])) {
echo "File ". $_FILES['photo']['name'] ." uploaded
successfully.\n";
echo "Displaying contents\n";
readfile($_FILES['photo']['tmp_name']);
} else {
echo "Possible file upload attack: ";

echo "filename '". $_FILES['photo']['tmp_name'] . "'.";
}

as a result i always gets this following error

Code:
Possible file upload attack: filename 'Array'.

first of all instead of displaying temporary file name it displayes ARRAY that means the tmp_name is holding array in it ...

Everything seems to be ok but i can't upload images, the very same code works on my all other sites... can this be due to my new server settings? or is it something to be set on server?

your help is really appreciated

ramoneguru

7:50 am on Nov 13, 2006 (gmt 0)

10+ Year Member



Check to make sure the file exists on the client machine....Your code seems fine, just like the manual. I believe PHP tends to print out simply 'Array' for a NULL array so I would venture to guess that something doesn't exist......................yet :P
--Nick

eelixduppy

11:53 am on Nov 13, 2006 (gmt 0)



Also check the configuration settings specifically for File Uploads [us3.php.net]. You may not have it enabled or you are trying to upload something too large.