PHP CODE HELP

$moveResult = move_uploaded_file($fileTmpLoc, “…/user/$db_file_name”);
if ($moveResult != true) {
header(“location: …/message.php?msg=ERROR: File upload failed”);
exit();
}

I dont know whats wrong with the code above. I keep getting the ERROR massage, “File upload failed”

What is the value of $fileTmpLoc?

bool move_uploaded_file ( string $filename , string $destination )

$fileTmpLoc = $_FILES[“avatar”][“tmp_name”];

Turn on error reporting. It may be something as simple as as not having write permission for the directory.

I added this to the script and nothing happened.

<?php error_reporting(-1); ?>

Don’t know where you found that but it should be this,

error_reporting(E_ALL);

// Report all PHP errors
error_reporting(-1);

This is from the php manual

But i tried the E_ALL and its not showing anything.
should i be echoing this somewhere?

Sponsor our Newsletter | Privacy Policy | Terms of Service