Hi, i got a problem while uploading a file. I got a code from www.w3schools.c om. I try the code, but the problem is that, i cannot specify the path where the file should stored. If i want to stored the file as "C:\wamp\www\pr actices" then what will be the syntax.. please to tell me in the following code.
This is my HTML file
[HTML]
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator " CONTENT="EditPl us">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Descripti on" CONTENT="">
</HEAD>
<BODY>
<form action="file_up load.php" method="post" enctype="multip art/form-data">
<label for="file">File Name:</label>
<input type="file" name="file" id="file"><br>
<input type="submit" name="submit" value="Upload">
</form>
</BODY>
</HTML>
[/HTML]
and this is my php file
[PHP]
<?php
if(($_FILES["file"]["type"] == "image/gif") || ($_FILES["file"]["type"] == "image/jpeg") || ($_FILES["file"]["type"] == "image/pjpeg") && ($_FILES["file"]["size"] <20000))
{
if($_FILES["file"]["error"] >0)
{
echo "Return Code:" .$_FIELS["file"]["error"]."<br>";
}
else
{
echo "Upload:" .$_FILES["file"]["name"]."<br>";
echo "Type:" .$_FILES["file"]["type"]."<br>";
echo "Size:" .($_FILES["file"]["size"]/1024)."Kb<br>";
echo "Tmep File" .$_FILES["file"]["tmp_name"]. "<br>";
if(file_exists( "../robin1/" .$_FILES["file"]["name"]))
{
echo $_FILES["file"]["name"]. "already exists.";
}
else
{
move_uploaded_f ile($_FILES["file"]["tmp_name"],
"../robin1/".$FILES["file"]["name"]);
echo "Stored in:". "../robin1/". $_FILES["file"]["name"];
}
}
}
else
{
echo "Invalid file";
}
?>
when i try this code it give the output as
Upload:save-petrol.gif
Type:image/gif
Size:123.631835 938Kb
Tmep FileC:\wamp\tmp \phpBD.tmp
Stored in:../robin1/save-petrol.gif
but, i dont know where is this file stored. Please help me............
[/PHP]
This is my HTML file
[HTML]
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator " CONTENT="EditPl us">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Descripti on" CONTENT="">
</HEAD>
<BODY>
<form action="file_up load.php" method="post" enctype="multip art/form-data">
<label for="file">File Name:</label>
<input type="file" name="file" id="file"><br>
<input type="submit" name="submit" value="Upload">
</form>
</BODY>
</HTML>
[/HTML]
and this is my php file
[PHP]
<?php
if(($_FILES["file"]["type"] == "image/gif") || ($_FILES["file"]["type"] == "image/jpeg") || ($_FILES["file"]["type"] == "image/pjpeg") && ($_FILES["file"]["size"] <20000))
{
if($_FILES["file"]["error"] >0)
{
echo "Return Code:" .$_FIELS["file"]["error"]."<br>";
}
else
{
echo "Upload:" .$_FILES["file"]["name"]."<br>";
echo "Type:" .$_FILES["file"]["type"]."<br>";
echo "Size:" .($_FILES["file"]["size"]/1024)."Kb<br>";
echo "Tmep File" .$_FILES["file"]["tmp_name"]. "<br>";
if(file_exists( "../robin1/" .$_FILES["file"]["name"]))
{
echo $_FILES["file"]["name"]. "already exists.";
}
else
{
move_uploaded_f ile($_FILES["file"]["tmp_name"],
"../robin1/".$FILES["file"]["name"]);
echo "Stored in:". "../robin1/". $_FILES["file"]["name"];
}
}
}
else
{
echo "Invalid file";
}
?>
when i try this code it give the output as
Upload:save-petrol.gif
Type:image/gif
Size:123.631835 938Kb
Tmep FileC:\wamp\tmp \phpBD.tmp
Stored in:../robin1/save-petrol.gif
but, i dont know where is this file stored. Please help me............
[/PHP]
Comment