Hello,
I have a HTML form through which I upload a file from the user's PC to the server. But my PHP script gives the error:
Warning: fopen(C:\local path to\filename): failed to open stream: No such file or directory
Note: I cannot use the POST method in HTML is because my webhost supports only GET method. Also I do not want to use FTP.
My observations: The $_FILES does not get populated also.
Somebody please help. Thanks a lot.
//////////////// HTML SCRIPT /////////////////////////////
My HTML script:
<form name="uploadForm" method=GET enctype="multipart/form-data" action="upload.php" onsubmit="return fileLoad_validate()">
<input type="hidden" name="MAX_FILE_SIZE" value="30000">
<input type="file" name="Filename" size=69></p>
<input type=submit name=B value="Upload File">
</form>
/////////////////// PHP SCRIPT ///////////////////////////
My PHP script upload.php:
<?php
error_reporting(E_ALL);
$Filename = $_REQUEST['Filename'];
$Filename = rtrim($Filename);
$Filename = stripslashes($Filename);
$f_hdl = fopen ($Filename, "r");
if(!$f_hdl)
{
print("Could not find your file. Try Again OR Report Error");
print("<A HREF=goBack.html>Go BACK</A>");
exit;
}
?>
///////////// end of php script ////////////////////////////////////