Jump to content

File uploading and File handling functions not working


EAGLE EYES

Recommended Posts

I am usin PHP 5.2 on IIS 7 with Fast CGI and Vista Ultimate

 

ON USING THIS CODE I GET HTTP ERROR 404 - NOT FOUND

 

The resource you are looking for has been removed, had its name changed, or is temporarily unavailable

 

<html>

<?php

if(isset($fupload))

{

print "path: $fupload<br>";

print "name: $fupload_name<br>";

print "size: $fupload_size";

copy($fupload,"f:\$fupload_name");

}

?>

 

<body>

<form enctype="multipart/form-data" action="<?php print $PHP_SELF ?>" method="POST">

<input type="hidden" name="MAX_FILE_SIZE" value="51200">

<input type="file" name="fupload"><br>

<input type="submit" value="click">

</form>

</body>

</html>

 

 

 

 

ALSO I GET BLANK SCREEN ON USING THIS CODE :

 

<html>

<body>

<?php

 

$filename="mirror.txt";

 

print (file_exists($filename))?"yes":"no";

 

$fp=fopen($filename,"r") or die("cant open");

 

while(!feof($fp))

{

 

$te=fgets($fp,1024);

 

print "$te";

 

}

 

fclose($fp);

 

 

?>

</body>

</html>

 

 

If you look at the "view source" of your form in your browser, you will probably find that the action="..." attribute is a php error message because $PHP_SELF was depreciated and turned off by default 7 years ago. It would be better if you used an empty action attribute to cause the page to submit to itself.

 

action=""

If you look at the "view source" of your form in your browser, you will probably find that the action="..." attribute is a php error message because $PHP_SELF was depreciated and turned off by default 7 years ago. It would be better if you used an empty action attribute to cause the page to submit to itself.

 

action=""

 

Following ur suggestion now i am getting a HTTP 405 Error -Method Not Allowed

I'm not sure about this, but you should use $_POST tags, not just variable names. Therefore, this becomes:

 

<?php
if(isset($_POST['fupload']))
{
print "path: ".$_POST['fupload']."<br>";
print "name: ".$_POST['fupload']['name']."<br>";
print "size: ".$_POST['fupload']['size'];
copy($_POST['fupload'], "f:\".$_POST['fupload']['name']);
}
?>

I'm not sure about this, but you should use $_POST tags, not just variable names. Therefore, this becomes:

 

<?php
if(isset($_POST['fupload']))
{
print "path: ".$_POST['fupload']."<br>";
print "name: ".$_POST['fupload']['name']."<br>";
print "size: ".$_POST['fupload']['size'];
copy($_POST['fupload'], "f:\".$_POST['fupload']['name']);
}
?>

 

 

It Does not work.........

HTTP 405 Error -Method Not Allowed

 

Either means that your form is not valid or that the URL of the current page + the relative URL is not valid - http://support.microsoft.com/kb/216493 , or that the server is not configured to accept the request that it received.

 

What is the current code for the form?

HTTP 405 Error -Method Not Allowed

 

Either means that your form is not valid or that the URL of the current page + the relative URL is not valid - http://support.microsoft.com/kb/216493 , or that the server is not configured to accept the request that it received.

 

What is the current code for the form?

 

The BUG u are talking about is in IIS 4 and IIS 5 it has been corrected in IIS 6 and i am using IIS 7

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.