Forum Moderators: coopster

Message Too Old, No Replies

file upload problems

file upload problems

         

Kings on steeds

12:14 pm on Aug 7, 2009 (gmt 0)

10+ Year Member



Please Help Me! I am ripping my hair out over this, I have a file upload function, that works fine locally and on every server I have use it on so far, but not working now? what am I doing wrong?

function uploadFile($filePostName,$uploadDir){
$uploadDirSafe = "./".$uploadDir;
$uploadDir = "".PHPBACE."".$uploadDir;
if($this->testUploadDir($uploadDir)){
$ourFileName = $_FILES[$filePostName]['name'];
if(move_uploaded_file($_FILES[$filePostName]['tmp_name'], $uploadDir."".$ourFileName)){
return $uploadDirSafe."".$ourFileName;
} else { $this->_error .= "<br />FILE UPLOAD:: no file"; return false; }
} else { $this->_error .= "<br />FILE UPLOAD:: upload dir not found -".$uploadDir; return false;}
}

called using

$file = $this->uploadFile('ourfile','./userfiles/');

It's returning the error no file... which is winding me up because testUploadDir is not failing, so it has write permissions and it can find the dir...and I am testing $_FILES before I try and upload I know its there...please help!

jatar_k

5:23 pm on Aug 7, 2009 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



so then it's move_uploaded_file that's failing?

have you verified that the image gets copied to the server? actually look in the folder it is supposed to be in, should still be there if it didn't get moved

can you verify, if it was uploaded, that the filename was exact?

it could also be a relative/absolute path issue

is it an uppercase/lowercase issue from going from a windows server to a *nix server?

these are all usual suspects for upload issues.