hi,
also ich hab hier vor Dateien direkt in der DB zu saven.
Über das Pro& contra habe ich mich informiert, also bitte diesbezüglich kein geflamme
infos:
http://www.itworld.com/nl/db_mgr/09022002/pf_index.html
http://lists.mysql.com/plusplus/4798
http://www.wellho.net/forum/The-MySQ...hemselves.html
lot's more
ok. Der Datei Up & download funktioniert soweit auch ohne Probleme, naja
FAST.
ich habe jetzt über mehrere Wege probiert das Filesize Limit einzubinden...siehe folgenden Code.
Das Tabellenfeld ist LONGBLOB, also ausreichend dimensioniert.
Files im Bereich 2 MB gehen ohne Probleme, bei meiner 13 MB testdatei kommt aber weder das Postiive noch das negative Feedback ..siehe unteres IF /ELSE
bin etwas ratlos.
hoffe ihr habt ne idee.
danke gruss
fidel_
und nun zum code:
--
also ich hab hier vor Dateien direkt in der DB zu saven.
Über das Pro& contra habe ich mich informiert, also bitte diesbezüglich kein geflamme

infos:
http://www.itworld.com/nl/db_mgr/09022002/pf_index.html
http://lists.mysql.com/plusplus/4798
http://www.wellho.net/forum/The-MySQ...hemselves.html
lot's more
ok. Der Datei Up & download funktioniert soweit auch ohne Probleme, naja
FAST.
ich habe jetzt über mehrere Wege probiert das Filesize Limit einzubinden...siehe folgenden Code.
Das Tabellenfeld ist LONGBLOB, also ausreichend dimensioniert.
Files im Bereich 2 MB gehen ohne Probleme, bei meiner 13 MB testdatei kommt aber weder das Postiive noch das negative Feedback ..siehe unteres IF /ELSE
bin etwas ratlos.
hoffe ihr habt ne idee.
danke gruss
fidel_
und nun zum code:
--
PHP-Code:
<?php
echo "<form method='post' enctype='multipart/form-data'>";
echo "<table width='700' border='0' cellpadding='1' cellspacing='1' class='box'>";
//
// Topic **********************************
echo "<tr>";
echo "<td></td>";
echo "<td colspan='2'><h2>Up & Download:</h2></td>";
echo "</tr>";
// HELP
echo "<tr>";
echo "<td></td>";
echo "<td colspan='2' align='right'>[url='./help/index.html'][img]images/icon_help.jpg[/img][/url]</td>";
echo "</tr>";
//
//
//
// Content START ********************************
//
echo "<tr>";
echo "<td colspan='3'></td>";
echo "</tr>";
// zu diesem Artikel
echo "<tr>";
echo "<td></td>";
echo "<td colspan='2'bgcolor='#dbded8'>[b]Dokumentation zu Artikel Nr: '".$_GET['identifier']."'[/b]</td>";
echo "</tr>";
// Spacer
echo "<tr>";
echo "<td colspan='3'></td>";
echo "</tr>";
// Spacer
echo "<tr>";
echo "<td colspan='3'></td>";
echo "</tr>";
// Doku Typ
echo "<tr>";
echo "<td width='60'></td>";
echo "<td width='200'>Doku-Typ:</td>";
echo "<td>";
echo "<select class='form' id='doku_typ' name='doku_typ'>";
echo "<option value=''>Bitte waehlen</option>";
$sql = " SELECT doku_typ_id,doku_typ_name
FROM KIS_doku_typ
ORDER BY doku_typ_name ASC;";
$result = mysql_query($sql) OR die(mysql_error());
while($row = mysql_fetch_assoc($result))
{
echo "<option value=\"".$row['doku_typ_id']."\">".$row['doku_typ_name']."</option>\n";
}
echo "</select>";
echo "</td>";
echo "</tr>";
// Notiz
echo "<tr>";
echo "<td></td>";
echo "<td width='200'>Doku-Notiz:</td>";
echo "<td><input size='30' name='doku_notiz' type='text'></td>";
echo "</tr>";
//
//
echo "<tr>";
echo "<td></td>";
echo "<td>Doku-Quelle:</td>";
//
// Test mit hidden Field
//
//
echo "<td><input name='userfile' type='file' id='userfile'></td>"; // ersatz, geht aber auch nicht
// echo "<td><input type='hidden' name='MAX_FILE_SIZE' value='20000000'><input name='userfile' type='file' id='userfile'></td>";
echo "</tr>";
// Blender
echo "<tr>";
echo "<td colspan='3'></td>";
echo "</tr>";
// bestehende Dateien Überschrift
echo "<tr>";
echo "<td></td>";
echo "<td colspan='2' bgcolor='#dbded8'>[b]Diese Dateien existieren bereits:[/b]</td>";
echo "</tr>";
// bestehende Dateien anzeigen
echo "<tr>";
echo "<td></td>";
echo "<td colspan='2'>";
// wir wollen existente dokus sehen, evlt auch zum DL
$query = "SELECT doku_id, name
FROM KIS_doku
WHERE KIS_artikel_artikel_inv_nummer = '".$_GET['identifier']."'";
$result = mysql_query($query) or die('Error, query failed');
if(mysql_num_rows($result) == 0)
{
echo "Es existieren aktuell noch keine Dokumenations-Unterlagen zu diesem Artikel.
";
}
else
{
while(list($id, $name) = mysql_fetch_array($result))
{
echo "<a href='dl.php?id=$id' target='_new'>"; // Link
echo $name;
echo "</a>
";
}
}
echo "</td>";
echo "</tr>";
// spacer
echo "<tr>";
echo "<td colspan='3'></td>";
echo "</tr>";
// Upload Button
echo "<tr>";
echo "<td></td>";
echo "<td colspan='2'><input name='upload' type='submit' class='box' id='upload' value='upload'></td>";
echo "</tr>";
// spacer
echo "<tr>";
echo "<td colspan='3'></td>";
echo "</tr>";
// spacer
echo "<tr>";
echo "<td colspan='3'></td>";
echo "</tr>";
// hinweis
echo "<tr>";
echo "<td></td>";
echo "<td colspan='2'>[b]Hinweis:[/b]</td>";
echo "</tr>";
// hinweis 1
echo "<tr>";
echo "<td></td>";
echo "<td colspan='2'>- Die Dateigroesse ist auf max. 20 mb limitiert.</td>";
echo "</tr>";
echo "</table>";
echo "</form>";
if(isset($_POST['upload']) && $_FILES['userfile']['size'] > 0)
{
// Some Debug Informations
//
//print_r($_FILES);
//print_r($_POST);
$doku_notiz = $_POST['doku_notiz'];
$doku_typ = $_POST['doku_typ'];
$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($tmpName));
$content = addslashes($content);
fclose($fp);
if(!get_magic_quotes_gpc())
{
$fileName = addslashes($fileName);
}
// Check auf filesize
// wenn kleiner 1mb, dann mach upload
if($fileSize < 20000000)
{
//mache Upload
$query = "INSERT INTO KIS_doku
(KIS_doku_typ_doku_typ_id,
KIS_artikel_artikel_inv_nummer,
doku_notiz,
name,
size,
type,
content)
VALUES ('$doku_typ',
'".$_GET['identifier']."',
'$doku_notiz',
'$fileName',
'$fileSize',
'$fileType',
'$content')";
mysql_query($query) or die('Error, query failed');
echo "<tr>";
echo "<td></td>";
echo "<td colspan='2'>Der Upload der Datei: $fileName ist erfolgreich abgeschlossen.</td>";
echo "</tr>";
}
else
{
echo "Die Datei ist leider zu gross, beachten Sie die Hinweise am Seitenende!";
}
}
?>
Kommentar