Page 1 of 1
Weird uploading problem
Posted: Mon May 30, 2005 3:53 pm
by John Cartwright
Hi, I use an uploading class to handle all my images, resizing, thumbnails etc but one day out of the blue this would not work properly. I can't really explain it since I never touched any server configurations or code, neither did my host.
Anyways, the code fails at
Code: Select all
if(!file_exists($_FILES[$this->field_name]['tmp_name']))
{
return $this->error(1);
}
even though when printing out $_FILES I get
Code: Select all
їmoneyshot] => Array
(
їname] => illusion.jpg
їtype] => image/pjpeg
їtmp_name] => /var/tmp/phpV9dQ92
їerror] => 0
їsize] => 27422
)
$this->field_name is moneyshot if your wondering. Anyone shed some light on this? It's been a rough few days

Posted: Mon May 30, 2005 4:23 pm
by Ambush Commander
Obviously, the file is not existing. Can you output the contents of the temporary directory right before the snippet?
Posted: Mon May 30, 2005 4:30 pm
by Skara
maybe they goofed the chmodding of everything? Something similar happened to me recently when, out of the blue, one of my hosts up and chmodded every single file to 644 or something. -_-'
Posted: Mon May 30, 2005 4:33 pm
by hongco
or maybe the tmp folder is full.
Posted: Mon May 30, 2005 4:33 pm
by John Cartwright
Not sure what you mean? I know its probably a path issue, but am sort of stumped as to why it suddenly stopped working.. I know I can read the temporary directly because the file is going somewhere..
Also chmod's are all fine.. help

Posted: Mon May 30, 2005 4:34 pm
by John Cartwright
hongco wrote:or maybe the tmp folder is full.
Temporary folders are constantly being deleted by apache .. arn't they? Should not be a problem.
Sorry I forgot to mention that I am using apache 1.3, with php 4.3.2
Posted: Mon May 30, 2005 4:37 pm
by hongco
not exactly. I have read posts posted by server owner complaining about temp folder being full. I could be wrong, but that's what they said.
Posted: Mon May 30, 2005 4:57 pm
by Burrito
maybe try "hard coding" one outside of your class and see if it works. If it does then you know it's an issue within your class...if not then you've narrowed down the prob.
does it do with all files (any size, type etc).
Posted: Mon May 30, 2005 5:05 pm
by John Cartwright
I don't really understand what you mean, because if the file never exists, how am I going to do anything with it? Also, yes the file type does not affect things, nor does filesize.
Posted: Mon May 30, 2005 5:08 pm
by Burrito
Jcart wrote:I don't really understand what you mean, because if the file never exists, how am I going to do anything with it? Also, yes the file type does not affect things, nor does filesize.
I'm just suggesting that you create the upload script on a new page (outside of your class) and try uploading again... just to ensure it's not something else in your class that's causing the explosion.
Posted: Mon May 30, 2005 5:25 pm
by John Cartwright
Code: Select all
if ( move_uploaded_file($_FILES['userfile']['tmp_name'],'images/'.$_FILES['userfile']['name']))
echo "success!";
else
echo "fail!";
That snipplet works fine, can anyone suggest why I am unable to detect the uploaded file in the temp dir?
Posted: Tue May 31, 2005 12:22 am
by ol4pr0
Not sure, but i dont think you are able to get whtvr is in the tmp dir
try
Code: Select all
$tmp_name = $_FILES[$file_name]['tmp_name'] #without obj
if(!file_exists($tmp_name))
{
return $this->error(1);
}
Posted: Tue May 31, 2005 9:24 pm
by John Cartwright
Then how do you explain my quick test? (my last post). I am able to read the temp file fine.
