I am having problem to insert my zip file in the database. Please help.
Share
I am having problem to insert my zip file in the database. Please help.
The first thing you can learn HTML, whether you want to become a professional web developer or just want to learn more about how websites work. The basic language for developing web pages and web applications is HTML. A server ...
Asynchronous Javascript One of AJAX’s benefits is it provides instantaneous feedback to the user because it requests information asynchronously from the backend web server. However, using AJAX does not guarantee the user will not wait for the asynchronous JavaScript and ...
How To Make Cookie Free Domain An HTTP cookie (also known as a web cookie, Internet cookie, browser cookie, or simply cookie) is a small piece of data sent from a website and stored on the user’s computer by the ...
First, of all I want to confirm you that, you only have to save the zip file name into the database. Zip file which you are saving will be uploaded into the server in some folder. And while fetching that zip file you have to check the zip file name from the database and the path where you have uploaded the file into your server.
<!–
Hospital Records
#dialogoverlay{
display: none;
opacity: .8;
position: fixed;
top: 0px;
left: 0px;
background: #FFF;
width: 100%;
z-index: 10;
}
#dialogbox{
display: none;
position: fixed;
background: #000;
border-radius:7px;
width:550px;
z-index: 10;
}
#dialogbox > div{ background:#FFF; margin:8px; }
#dialogbox > div > #dialogboxhead{ background: #ff0000; font-size:19px; padding:10px; color:#CCC; }
#dialogbox > div > #dialogboxbody{ background:#333; padding:20px; color:#FFF; }
#dialogbox > div > #dialogboxfoot{ background: #666; padding:10px; text-align:right; }
Patient Registration
<?php
if(isset($_POST['Submit'])){
$rand = rand(10,100);
$streplaceFileName = $_FILES['zipFile']['name'];
$zipFile = $rand."-".$streplaceFileName;
$ds = DIRECTORY_SEPARATOR;
$storeFolder = "uploads/";
if((!empty($_FILES)) && !empty($_FILES['zipFile']['name'])) {
if(preg_match('/[.](zip)$/', $_FILES['zipFile']['name'])) {
$filename = $rand . "-" . $streplaceFileName;
$tempFile = $_FILES['zipFile']['tmp_name'];
$targetPath = $storeFolder . $ds;
$targetFile = $targetPath.$filename;
$check = move_uploaded_file($tempFile,$targetFile);
}
}
function cleanSpecialCharacters($string) {
$string = str_replace(' ', '-', $string); // Replaces all spaces with hyphens.
return preg_replace('/[^A-Za-z0-9.\-]/', '', $string); // Removes special chars.
}
}
$Reason=$_POST["reason"];
$Bpsys=$_POST["Bpsys"];
$Bpdia=$_POST["Bpdia"];
$temp=$_POST["temp"];
$pulse=$_POST["pulse"];
$resp=$_POST["resp"];
$weight=$_POST["weight"];
$height=$_POST["height"];
$symp=$_POST["symp"];
$sym=$_POST["sym"];
$diag=$_POST["diag"];
$diags=$_POST["diags"];
$pres=$_POST["pres"];
$stren=$_POST["stren"];
$direc=$_POST["direc"];
$qty=$_POST["qty"];
$treat=$_POST["treat"];
$test=$_POST["test"];
$testdet=$_POST["testdet"];
//sql insert statement-record saving in my database
$sql="INSERT INTO history (Patient_Id,Reason,Bpsys,Bpdia,Temp,Pulse,Resp,Weight,Height,Symp,Sym,Diag,Diags,Dname,Stren,Direc,Qty,Treat,Tname,Tdet,file,type) VALUES ('$_POST[Id]','$Reason','$Bpsys','$Bpdia','$temp','$pulse','$resp','$weight','$height','$symp','$sym','$diag','$diags','$pres','$stren','$direc','$qty','$treat','$test','$testdet','$filename','$tempFile')";
$result2 = mysql_query($sql) or die('Query failed: ' .mysql_error());
echo 'Thank you for ADDING ! ‘;
?>
thanx