<form action="" method="post" enctype="multipart/form-data">
<input type="text" name="name" value="" />
<input type="text" name="lname" value="" />
<input type="file" name="imageupload" value="" />
</form>
<?php
if($_SERVER['REQUEST_METHOD']=="POST")
{
$name=$_POST["name"];
$name=$_POST["lname"];
if($_FILES['imageupload']['name'])
{
$filename = $_FILES["imageupload"]["name"];
$fileType = $_FILES["imageupload"]["type"];
$fileSize = $_FILES["imageupload"]["size"];
$fileTemp = $_FILES["imageupload"]["tmp_name"];
$error = $_FILES["imageupload"]["error"];
$image = time().$filename;
}
$queryInsert = "insert into projects(id,name,lname,image)values('','$name','$lname','$image')";
$resultSelect = mysql_query($queryInsert);
if($_FILES['imageupload']['name'])
{
move_uploaded_file($fileTemp,'uploads/'.$image);
chmod('uploads/'.$image,0777);
}
header("Location:view.php");
}
<input type="text" name="name" value="" />
<input type="text" name="lname" value="" />
<input type="file" name="imageupload" value="" />
</form>
<?php
if($_SERVER['REQUEST_METHOD']=="POST")
{
$name=$_POST["name"];
$name=$_POST["lname"];
if($_FILES['imageupload']['name'])
{
$filename = $_FILES["imageupload"]["name"];
$fileType = $_FILES["imageupload"]["type"];
$fileSize = $_FILES["imageupload"]["size"];
$fileTemp = $_FILES["imageupload"]["tmp_name"];
$error = $_FILES["imageupload"]["error"];
$image = time().$filename;
}
$queryInsert = "insert into projects(id,name,lname,image)values('','$name','$lname','$image')";
$resultSelect = mysql_query($queryInsert);
if($_FILES['imageupload']['name'])
{
move_uploaded_file($fileTemp,'uploads/'.$image);
chmod('uploads/'.$image,0777);
}
header("Location:view.php");
}
No comments:
Post a Comment