Step I : First Create a Page In Html For Uploading (Try The Following Code In Order To So)
<html>
<body bgcolor='black'>
<table align="center">
<tr>
<td>
<form action="fileupload.php" method="post" enctype="multipart/form-data" >
<font color="#0d8ffe" size="2" ><u>File Upload</u></font> <input name="file" type="file" class="pimg1" />
<input type="submit" value="Upload" style="background:#0d8ffe;border:0;"/>
</form>
</td>
</tr>
</table>
</body>
</html>
Step II : Then Use The Following Function To Move The file To Desire Locaton.
<?php
if(empty($_FILES["file"]["name"]))
{
header("Location:entry.php");
exit;
}
require "comm.php";
$filename = $_FILES["file"]["name"];
$name=split("\.",$filename);
$nm = $name[0];
$ext = $name[1];
move_uploaded_file($_FILES["file"]["tmp_name"],"$nm.$ext");
?>
<html>
<body bgcolor='black'>
<table align="center">
<tr>
<td>
<form action="fileupload.php" method="post" enctype="multipart/form-data" >
<font color="#0d8ffe" size="2" ><u>File Upload</u></font> <input name="file" type="file" class="pimg1" />
<input type="submit" value="Upload" style="background:#0d8ffe;border:0;"/>
</form>
</td>
</tr>
</table>
</body>
</html>
Step II : Then Use The Following Function To Move The file To Desire Locaton.
<?php
if(empty($_FILES["file"]["name"]))
{
header("Location:entry.php");
exit;
}
require "comm.php";
$filename = $_FILES["file"]["name"];
$name=split("\.",$filename);
$nm = $name[0];
$ext = $name[1];
move_uploaded_file($_FILES["file"]["tmp_name"],"$nm.$ext");
?>
No comments:
Post a Comment