He leido este post y yo tambien tenida la misma cuestion, investigando y estudiando un poco un codigo conseguir hacerme este escript. permite subir documentos o fotos al server con una tabla de mysql de registro, quiza les interese. tienen que hacer dos carpetas: una temp y otra docs:
Código PHP:
<html>
<head>
<title>Upload File To MySQL Database</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
.box {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
border: 1px solid #000000;
}
-->
</style>
</head>
<body>
<?
if(isset($_POST['upload']))
{
$fileName = $_FILES['userfile']['name'];
$tmpName = $_FILES['userfile']['tmp_name'];
$fileSize = $_FILES['userfile']['size'];
$fileType = $_FILES['userfile']['type'];
$fp = fopen($tmpName, 'r');
$content = fread($fp, $fileSize);
$content = addslashes($content);
fclose($fp);
if(!get_magic_quotes_gpc())
{
$fileName = addslashes($fileName);
}
include 'c:\apache\php\pear\PEAR\config.php';
include 'db.php';
$query = "INSERT INTO docs (imo, name, size, type, path ) ".
"VALUES ('$imo', '$fileName', '$fileSize', '$fileType', '$filePath')";
mysql_query($query) or die('Error, query failed : ' . mysql_error());
echo "<br>File uploaded<br>";
}
?>
<form action="" method="post" enctype="multipart/form-data" name="uploadform">
<table width="350" border="0" cellpadding="1" cellspacing="1" class="box">
<tr>
<td width="246"><p>
<input type="hidden" name="MAX_FILE_SIZE" value="100000000">
Imo
<input type="text" name="imo" id="imo">
</p>
<p>
<input name="userfile" type="file" class="box" id="userfile">
</p></td>
<td width="80"><input name="upload" type="submit" class="box" id="upload" value=" Upload "></td>
</tr>
</table>
</form>
</body>
</html>