Viewing file: addImage.php (1.58 KB) -rwxr-xr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<head>
<link rel="stylesheet" type="text/css" href="Themes/DeepWater/Style.css">
</head>
<body bgcolor="#39597b" link="#000000" alink="#ff0000" vlink="#000099" text="#ffffff" class="DeepWaterPageBODY">
<h2><center>Unesi novu sliku</center></h2>
<?
// code that will be executed if the form has been submitted:
if ($submit) {
// connect to the database
// (you may have to adjust the hostname,username or password)
MYSQL_CONNECT("localhost","us10505a","proba");
mysql_select_db("db10505p");
$data = addslashes(fread(fopen($form_data, "r"), filesize($form_data)));
$result=MYSQL_QUERY("INSERT INTO images (description,bin_data,filename,filesize,filetype) ".
"VALUES ('$form_description','$data','$form_data_name','$form_data_size','$form_data_type')");
$id= mysql_insert_id();
print "<p>Fajl je unesen u bazu";
MYSQL_CLOSE();
?>
<script type="text/javascript">
<!--
function shutDown() {
self.close();
}
function init() {
var timer = setInterval(shutDown, 2000);
}
onload = init;
//-->
</script>
<?
} else {
// else show the form to submit new data:
?>
<form method="post" action="<?php echo $PHP_SELF; ?>" enctype="multipart/form-data">
Naziv slike:<br>
<input type="text" name="form_description" size="30">
<INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="1000000">
<br>Fajl sa slikom za unos:<br>
<input type="file" name="form_data" size="30">
<p><input type="submit" name="submit" value="submit">
</form>
<?php
}
?>
</body>
|