Octal Enterprises
step 1: create Folder in wamp server/ www/folder name File
step 2: copy my code and paste in your php file
Step 3: Run Your Program
What yar u can import any file in our file folder enjoy-->
<?php
if(isset($_REQUEST["submit"]))
{
$file=$_FILES["file"]["name"];
$temp=$_FILES["file"]["tmp_name"];
$path="file/".$file;
$file1=explode(".",$file);
$ext=$file1[1];
$allowed=array("jpg","mp4");
if(in_array($ext,$allowed))
{
move_uploaded_file($temp,$path);
}
else
{
echo"<script>alert('invalid file')</script>";
}
}
?>
<html >
<head>
</head>
<body>
<form action="" name="form1" id="form1" method="post" enctype="multipart/form-data">
<table>
<tr>
<td>file</td>
<td><input type="file" name="file" id="file" /></td>
</tr>
<tr>
<td><input type="submit" id="submit" name="submit" value="submit" /></td>
</tr>
</table>
</form>
</body>
</html>
No comments:
Post a Comment