yanike
yanike

Reputation: 847

php uploading file

I got EVERYTHING, but this working. I can't get the move_uploaded_file(); to work.

$ups_path = "ups/files";
$nfile = $_FILES['nfile']['tmp_name'];
$cfile = move_uploaded_file($nfile, $ups_path);

if($cfile){
header ('Location: index.php?give=fileuploaded');
} else {
header ('Location: index.php?give=filenotuploaded');
}

It always returns the error for not moving it.

Upvotes: 0

Views: 102

Answers (2)

Mel
Mel

Reputation: 6157

If ups/files a directory then this will fail. move_uploaded_file expects the second argument to be a filename, not a directory.

Upvotes: 1

johndodo
johndodo

Reputation: 18271

Try using the absolute path instead of relative one:

$ups_path = "/var/www/somewhere/ups/files";

Upvotes: 0

Related Questions