I am trying to make a php script that uploads files
I having some problems with the script.
The error message :
c:/diphp/webroot/fileup
File uploaded Successfully
Warning: fopen(c:/diphp/webroot/fileup): failed to open stream: Permission denied in c:\diphp\webroot\uploadfile.php on line 52
Warning: fread(): supplied argument is not a valid stream resource in c:\diphp\webroot\uploadfile.php on line 53
Warning: fclose(): supplied argument is not a valid stream resource in c:\diphp\webroot\uploadfile.php on line 54
Preview of uploaded file contents:
Please HELP I don’t know what to do. I did a search on google but I was unlucky and I didn’t find anything.
The permissions on the script they are probably ok.
Is by any chance on the php.ini something that I have to add?????
Thank you
The php script:
<?php
if (userfile=="none")
{
echo "Problem : No file uploaded";
exit();
}
$upfile = $_SERVER["DOCUMENT_ROOT"]."/fileup".$userfile_name;
echo $upfile;
echo "<br>";
LINE --> 51 echo "File uploaded Successfully<br><br>";
LINE --> 52$fp = fopen($upfile, "r");
LINE --> 53$contents = fread ($fp, filesize ($upfile));
LINE --> 54fclose ($fp);
$contents = strip_tags($contents);
$fp = fopen(upfile, "w");
fwrite($fp, $contents);
fclose($fp);
echo "Preview of uploaded file contents:<br><br>";
echo $contents;
echo "<br><br>";
?>