Forum Moderators: coopster
[webmasterworld.com...] - msg 29
there are a bunch of threads about mysql in the PHP Library [webmasterworld.com]
[webmasterworld.com...]
Note: There is a spin-off thread in there that discusses the very topic in which jatar_k is referring.
<html>
<head><title>Store binary data into SQL Database</title></head>
<body>
<?php
// code that will be executed if the form has been submitted:
require "db1.inc";
if ($submit) {
// connect to the database
// (you may have to adjust the hostname,username or password)
MYSQL_CONNECT("localhost","root","password");
mysql_select_db("binary_data");
$data = addslashes(fread(fopen($form_data_name, "r"), filesize($form_data_name)));
$result=MYSQL_QUERY("INSERT INTO binary_data (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>This file has the following Database ID: <b>$id</b>";
MYSQL_CLOSE();
} else {
<form method="post" action="<?php echo $PHP_SELF;?>" enctype="multipart/form-data">
File Description:<br>
<input type="text" name="form_description" size="40">
<input type="hidden" name="MAX_FILE_SIZE" value="1000000">
<br>File to upload/store in database:<br>
<input type="file" name="form_data_name" size="40">
<p><input type="submit" name="submit" value="submit">
</form>
?>
<?php
}
?>
</body>
</html>
[webmasterworld.com...]
-----------------------------------------------------
What does the following if statements mean?
1.if ($_FILES['userfile']['name'][$q] == "")
2.if (move_uploaded_file($_FILES['userfile']['tmp_name'][$q], $uploaddir . $new_pic))
What is $source_x $source_y representing?
3.$source_x = $picsize[0];
$source_y = $picsize;
if ($source_x > $source_y){
$dest_x = 200;
$dest_y = 150;
} else {
$dest_x = 150;
$dest_y = 200;
}
How is name defined here?
4.<input type="text" name="pic_name[<?=$num?>]"
[edited by: coopster at 12:10 am (utc) on Mar. 7, 2006]
[edit reason] snipped code, provided link [/edit]