Hello
I am using the following code to copy a file from one directory to another:
<?php
// Upload photo files ...
if (isset($file_name) and $file_name != ""){
// upload file ... get extension first ...
$afile = basename($file_name);
$afile = explode (".", $afile);
end($afile);
$extension = current($afile);
$new_file_name = $DOCUMENT_ROOT."/".$id."_".$nomenclature.".".$extension;
if (is_readable($file_name)){
if (!copy($file_name, $new_file_name)) {
$e->errstr = "Could not copy file <b>".$file_name."</b> to <b>".$new_file_name."</b>.";
$e->method = "Upload";
}
}else{
$e->errstr = "File <b>".$file_name."</b> is not readable.";
$e->method = "Upload";
}
}
}
?>
The variable $file_name is obtained from a form field with input type="file" under windows NT.
The piece of code is part of an application and it keeps returning the message that the FILE IS NOT READABLE. I have an Apache Linux setup and I have full rights to all directories, to read (from $file_name directory) and write (to $new_file_name directory).
Can anyone suggest what I could do to fix this problem ...
++Tx
Pete