how to add size limit in this code?
I am new to php. Trying to create forms. i found this code online but when i upload a file it accepts only 700kb
files and not more then that otherwise it gives an error. I need at least 20mb
. what I will have to write in my code to make it work? even it should help in updating.
Please help
<body>
<div id="art-main">
<div id="art-header-bg" class="clearfix">
</div>
<div id="art-hmenu-bg" class="art-bar art-nav clearfix">
</div>
<div class="art-sheet clearfix">
<header class="art-header clearfix">
<div class="art-shapes">
<h1 class="art-headline" data-left="0.5%">
<a href="http://www.99demos.blogspot.com" target="_blank">library</a>
</h1>
<h2 class="art-slogan" data-left="87.05%"><a href="http://99demos.blogspot.in/2014/06/createreadupdate-delete-with-image.html"></a></h2>
</div>
<nav class="art-nav clearfix">
<div class="art-nav-inner">
<ul class="art-hmenu"><li><a href="index.php" class="active">Home</a></li></ul>
</div>
</nav>
</header>
<div class="art-layout-wrapper clearfix">
<div class="art-content-layout">
<div class="art-content-layout-row">
<div class="art-layout-cell art-content clearfix"><article class="art-post art-article">
<h2 class="art-postheader">customer form</h2>
<div class="art-postcontent art-postcontent-0 clearfix"><div class="art-content-layout">
<div class="art-content-layout-row">
<div class="art-layout-cell layout-item-0" style="width: 100%" >
<br>
<?php
ob_start();
include('include/connect.php');
if (isset($_GET['id'])) {
$qry = "SELECT * FROM tbl_emp where id=" . $_GET['id'];
$result = mysql_query($qry);
$row = mysql_fetch_array($result);
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$name = $_POST["name"];
$age = $_POST["age"];
$gender = $_POST['gender'];
$martial = $_POST["martial"];
$contact = $_POST["contact"];
$email = $_POST["email"];
$location = $_POST["location"];
$drname = $_POST["drname"];
$cname = $_POST["cname"];
$clocation = $_POST["clocation"];
$implants = implode(',', $_POST['implants']);
$problem = $_POST["problem"];
$tgiven = $_POST["tgiven"];
$tdate = $_POST["tdate"];
IF ($_FILES['file']['name'] != '') {
$file = 'uploads/' . $row['image'];
@unlink($file);
$tmp_name = $_FILES["file"]["tmp_name"];
$namefile = $_FILES["file"]["name"];
$ext = end(explode(".", $namefile));
$image_name = time() . "." . $ext;
$fileUpload = move_uploaded_file($tmp_name, "uploads/" . $image_name);
} else {
$image_name = $row['image'];
}
$sqlAdd = "update tbl_emp set name='" . $name . "', age='" . $age . "', gender='" . $gender . "', martial='" . $martial . "', contact='" . $contact . "', email='" . $email . "', location='" . $location . "', drname='" . $drname . "', cname='" . $cname . "', clocation='" . $clocation . "', implants='" . $implants . "', problem='" . $problem . "', tgiven='" . $tgiven . "', tdate='" . $tdate . "', image='" . $image_name . "' where id=" . $_GET['id'];
mysql_query($sqlAdd);
header("Location:add.php?id=" . @$_GET['id'] . "&msg=success");
exit;
}
} else {
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$name = $_POST["name"];
$age = $_POST["age"];
$gender = $_POST['gender'];
$martial = $_POST["martial"];
$contact = $_POST["contact"];
$email = $_POST["email"];
$location = $_POST["location"];
$drname = $_POST["drname"];
$cname = $_POST["cname"];
$clocation = $_POST["clocation"];
$implants = $_POST["implants"];
$problem = $_POST["problem"];
$tgiven = $_POST["tgiven"];
$tdate = $_POST["tdate"];
IF ($_FILES['file']['name'] != '') {
$tmp_name = $_FILES["file"]["tmp_name"];
$namefile = $_FILES["file"]["name"];
$ext = end(explode(".", $namefile));
$image_name = time() . "." . $ext;
$fileUpload = move_uploaded_file($tmp_name, "uploads/" . $image_name);
}
$sqlAdd = mysql_query("insert into tbl_emp(name,age,gender,martial,contact,email,location,drname,cname,clocation,implants,problem,tgiven,tdate,image) VALUES('$name','$age','$gender','$martial','$contact','$email','$location','$drname','$cname','$clocation','$implants','$problem','$tgiven','$tdate','$image_name')");
header("Location:index.php?msg=success");
exit;
}
}
ob_end_flush();
if (isset($_GET['msg'])) {
?>
<div style="color:red;padding-bottom:10px;" class="form-message" align="center"><b>Task completd successfully.</b></div>
<?php
}
?>
<form method="post" name="login" id="login" enctype="multipart/form-data">
<table class="table" width="100%">
<tr>
<td width="10%">Customer Details</td>
<td></td>
</tr>
<tr>
<td width="10%">Full Name</td>
<td><input name="name" type="text" placeholder="Firstname Lastname" pattern="[A-Za-z-0-9]+\s[A-Za-z-'0-9]+" required value="<?php echo @$row['name']; ?>"></td>
</tr>
<tr>
<td width="20%">Age</td>
<td><input name="age" type="text" value="<?php echo @$row['2']; ?>" ></td>
</tr>
<tr>
<td>Gender</td>
<td><input type="Radio" name="gender" value="male" <?php
if ($gender == 'male') {
echo 'checked';
}
?> />
Male
<input type="Radio" name="gender" value="female" <?php
if ($gender == 'female') {
echo 'checked';
}
?> />
Female</td>
</tr>
<tr>
<td width="10%">Martial Status</td>
<td><input name="martial" type="text" value="<?php echo @$row['4']; ?>" ></td>
</tr>
<tr>
<td width="20%">Contact Number</td>
<td><input name="contact" type="text" value="<?php echo @$row['5']; ?>"></td>
</tr>
<tr>
<td width="10%">Email Address</td>
<td><input name="email" type="text" value="<?php echo @$row['6']; ?>"></td>
</tr>
<tr>
<td width="10%">Location</td>
<td><input name="location" type="text" value="<?php echo @$row['7']; ?>" ></td>
</tr>
<tr>
<td width="10%">Treatment Details</td>
<td></td>
</tr>
<tr>
<td width="10%">Doctor Name</td>
<td><input name="drname" type="text" value="<?php echo @$row['8']; ?>" ></td>
</tr>
<tr>
<td width="10%">Clinic Name</td>
<td><input name="cname" type="text" value="<?php echo @$row['9']; ?>" ></td>
</tr>
<tr>
<td width="10%">Clinic Location & Branch</td>
<td><input name="clocation" type="text" value="<?php echo @$row['10']; ?>" ></td>
</tr>
<tr>
<td width="10%">Implants</td>
<td>
<select name="implants" id="implants" value="<?php echo @$row['11']; ?>">
<option <?php if ($implants == '1') echo 'selected="selected'; ?> value="1">1</option>
<option <?php if ($implants == '2') echo 'selected="selected'; ?> value="2">2</option>
<option <?php if ($implants == '3') echo 'selected="selected'; ?> value="3">3</option>
</select>
</td>
</tr>
<tr>
<td width="10%">Problem</td>
<td><input name="problem" type="text" value="<?php echo @$row['12']; ?>" ></td>
</tr>
<tr>
<td width="10%">Treatment Given</td>
<td><input name="tgiven" type="text" value="<?php echo @$row['13']; ?>" ></td>
</tr>
<tr>
<td width="10%">Treatment Date</td>
<td><input name="tdate" type="date" value="<?php echo @$row['14']; ?>" ></td>
</tr>
<tr>
<td>multifile
<td>
<input id="fileupload" type="file" multiple="multiple" />
<hr />
<b>Live Preview</b>
<br />
<br />
<div id="dvPreview">
</div>
</td>
</tr>
<tr>
<td width="10%">X-Ray Image</td>
<td><input name="file" type="file" multiple="" ></td>
</tr>
<?php
if (isset($row['image'])) {
?>
<tr>
<td> </td>
<td><img src="uploads/<?php echo $row['image']; ?> " height="50" width="50"></td>
</tr>
<?php
}
?>
<tr>
<td> </td>
<td>
<input name="submit" value="Submit" type="submit" class="submit">
<input name="submit" value="Cancel" type="button" class="submit" onClick="window.location = 'index.php'">
</td>
</tr>
</table>
</form>
</div>
</div>
</div>
</div>
</article></div>
</div>
</div>
</div>
</div>
<footer class="art-footer clearfix">
<div class="art-footer-inner">
<p>Copyright © 2016. All Rights Reserved.</p>
<p class="art-page-footer">
</p>
</div>
</footer>
</div>
my php.ini file
; This file is for CGI/FastCGI installations.
; Try copying it to php5.ini, if it doesn't work
; adjust memory limit
memory_limit = 64M
max_execution_time = 18000
; disable magic quotes for php request vars
magic_quotes_gpc = off
; disable automatic session start
; before autoload was initialized
flag session.auto_start = off
; enable resulting html compression
zlib.output_compression = on
; disable user agent verification to not break multiple image upload
suhosin.session.cryptua = off
; turn off compatibility with PHP4 when dealing with objects
zend.ze1_compatibility_mode = off
; PHP for some reason ignores this setting in system php.ini
; and disables mcrypt if this line is missing in local php.ini
extension=mcrypt.so
; Disable PHP errors, notices and warnings output in production mode to prevent exposing sensitive information.
display_errors = Off