Entry
Warning: open_basedir restriction in effect. File is in wrong directory in /home/httpd/vhosts/corvet
Sep 8th, 2002 12:09
Reza A Tabibazar, Chris Name,
That is because the safe mode is turned on.
Just use move_uploaded_file() instead of copy()
working example;
-----------------------------
<HTML>
<TITLE>
File upload
</title>
<body>
<B>File upload</b>
<form enctype="multipart/form-data" action="<?PHP echo $PHP_SELF ?>"
method="post">
<input type="hidden" name="MAX_FILE_SIZE" value="1000000">
Send this file:
<input name="userfile" type="file">
<input type="submit" name="submit" value="Send File">
</form>
</body>
<?PHP
// copy to this directory
$dir="./uploads/";
// copy the file to the server
if (isset($submit)){
if (!is_uploaded_file ($userfile)){
echo "<b>$userfile_name</b> couldn't be copied !!";
}
// check whether it has been uploaded
if (is_uploaded_file ($userfile)){
move_uploaded_file($userfile,$dir.$userfile_name) ;}
echo "<b>$userfile_name</b> copied succesfully !!";
}
?>
</html>