I suggest you read http://www.php.net/manual/en/features.file-upload.php

The GET method shouldn't work (though it may be possible). In all likelihood
your browser is just sending the local filename as a string and not
attempting to upload the file at all.

You need to use the Array $_FILES['Filename'] to access the various bits of
data about the file. Try doing print_r($_FILES); in upload.php to see if
it's there.

I would guess that a host that does not allow the POST method would not
allow file uploads at all.

CHris
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Tuesday, December 16, 2003 9:37 PM
To: [EMAIL PROTECTED]
Subject: [PHP] PHP: remote file open problem



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 ////////////////////////////////////

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to