i am trying to upload a file to the server, i found basic tutorials to do so, but moveuploaded file fails
i tried to debug the script and it appears that all the variables are correct, the file path is valid on the server, and the tmpfile path and name appear correct, this is the php i am using
[code=php]<?php
foreach($_POST as $key => $value){
if($value != “”){
$message .= $key. ” ——— ” . $value. “n” ;
echo $key . ” —– ” . $value. “<br>”;
}else{
$error = true;
}
}
foreach($_FILES as $myfile => $xxx){
foreach($xxx as $uploadedfile => $name){
echo $uploadedfile . ” —– ” . $name . “<br>”;
}
}
$target_path = getcwd(). “/upload/”;
echo $_FILES[“uploadedfile”][“tmp_name”].”<br>”;
echo exec(‘whoami’);
chmod($_FILES[“uploadedfile”][“name”],0777);
echo substr(sprintf(‘%o’, fileperms($_FILES[“uploadedfile”][“tmp_name”])), -4).”<br>”;
// ulink($_FILES[“uploadedfile”][“tmp_name”]);
echo $_FILES[“uploadedfile”][“name”].”<br>”;
$target_path = $target_path . basename( $_FILES[‘uploadedfile’][‘name’]);
// copy($_FILES[“uploadedfile”][“tmp_name”], $target_path . $_FILES[“uploadedfile”][“name”]);
echo $target_path.”<br>”;
if(move_uploaded_file($_FILES[‘uploadedfile’][‘tmp_name’], $target_path)) {
echo “The file “. basename( $_FILES[‘uploadedfile’][‘name’]).
” has been uploaded”;
} else{
echo “There was an error uploading the file, please try again!”;
}
?>
i have 2 file inputs in a htm page and get a return like
[QUOTE]
MAX_FILE_SIZE —– 1000000
name —– bin_file.txt
type —– text/plain
tmp_name —– /tmp/phpMtU95N
error —– 0
size —– 4135
name —–
type —–
tmp_name —–
error —– 4
size —– 0
/tmp/phpMtU95N
apache0600
bin_file.txt
/home/***/castagna/upload/bin_file.txt
There was an error uploading the file, please try again!
only 1 file input filled
i do not find the tmpfile in the server tmp folder
the chmod does not appear to change the permissions, maybe apache is not authorised to do so?
if found this in a thread here, courtsey //./
<?php echo phpinfo(); ?>
which returns
way too much to post here,
but i can post any parts that may help