Google Search
Google Search
HTML/JavaScript
Monday, August 29, 2011
image upload php
//upload file size
ini_set("upload_max_filesize","10M");
ini_set("post_max_size","10M");
ini_set("max_execution_time","10M");
ini_set("max_input_time","10M");
$dateposted =date("Y-m-d");
if(isset($_REQUEST['submit']))
{
extract($_REQUEST);
$c1 = rand(0,9);$c2 = rand(0,9);$c3 = rand(0,9);$c4 = rand(0,9);
$rand = $c1.$c2.$c3.$c4;
$dir_path = "booksummaries/".$rand.$_FILES['pdf']['name'];
$c1 = rand(0,9);$c2 = rand(0,9);$c3 = rand(0,9);$c4 = rand(0,9);
$rand = $c1.$c2.$c3.$c4;
$dir_path1 = "booksummaries/".$rand.$_FILES['image']['name'];
if($_FILES['pdf']['name'] && $_FILES['image']['name']){
move_uploaded_file($_FILES['pdf']['tmp_name'],$dir_path);
move_uploaded_file($_FILES['image']['tmp_name'],$dir_path1);
$in="UPDATE ".BOOKSSUMMARYLIST." set `title`='$title',`image`='$dir_path1',`file`='$dir_path' where `id`='".$_REQUEST['id']."'";
}
elseif($_FILES['pdf']['name']){
move_uploaded_file($_FILES['pdf']['tmp_name'],$dir_path);
$in="UPDATE ".BOOKSSUMMARYLIST." set `title`='$title',`file`='$dir_path' where `id`='".$_REQUEST['id']."'";
}
elseif($_FILES['image']['name']){
move_uploaded_file($_FILES['image']['tmp_name'],$dir_path1);
$in="UPDATE ".BOOKSSUMMARYLIST." set `title`='$title',`image`='$dir_path1' where `id`='".$_REQUEST['id']."'";
}
else {
$in="UPDATE ".BOOKSSUMMARYLIST." set `title`='$title' where `id`='".$_REQUEST['id']."'";
}
$out=mysql_query($in);
$msg="Book information updated Successfully";
echo "<meta http-equiv='refresh' content='3;url=books_summary_list.php?id=$_REQUEST[id]&page=$_REQUEST[page]'>";
}
$in="select * from ".BOOKSSUMMARYLIST." where `id`='".$_REQUEST['id']."'";
$out=mysql_query($in);
$record=mysql_fetch_array($out);
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment