Mailinglisten-Archive |
Hallo Martin, hallo Liste,
anbei die momentanen scripte. Zusatzinfo, ich teste hier mit WAMP (mysql:
3.21.29, php: 3.06).
Fehlermeldung beim eintragen:
Warning: Unlink failed(Permission denied) in
c:\apache\htdocs\image4\load.php3 on line 11 "ist die unlink($fileinput);"
succesful add
Beim wiederaufrufen nehme ich die image.php3 oder die viewbanner.php3.
Bei image.php3 Fehlermeldung: Warning 0 is not a MySQL result index in line
6
Bei viewbanner.php3 Keine Fehlermeldung, aber nur Kryptische Zeichen als
result.
Die DB heisst "test", die Tabelle "bin"
hier die load.php3
<?
require("header.inc");
if(isset($submit)){
$date = date("Y-m-d");
chop($fileinput)!=""){
$image = addslashes(fread(fopen($fileinput,"r"), 1000000));
$SQL = "Insert Into bin (title,auth_id,description,category,body,cr_date,type) values ('$title', '$auth_id', '$desc', '$cat', '$image','$date','$type')";
unlink($fileinput);
}
else{
echo "no file entered on form";
exit;
}
$Result = mysql_db_query ("test", $SQL);
if($Result==0){
echo "unsuccessful add";
}
else{
echo "successful add";
}
}
?>
<table border="1" bgcolor="#9999FF" cellpadding="5" width="350">
<tr>
<td>
<form method="post" action="load.php3" enctype="multipart/form-data">
<table border="0" width="100%">
<tr>
<td align="right">Name:</td>
<td bgcolor="#CCCCFF">
<input type="text" name="title" style="width:200px;">
</td>
</tr>
<tr>
<td align="right">auth id:</td>
<td bgcolor="#CCCCFF">
<input type="text" name="auth_id" style="width:200px;">
</td>
</tr>
<tr>
<td align="right">beschreibung:</td>
<td bgcolor="#CCCCFF">
<input type="text" name="desc" style="width:200px;">
</td>
</tr>
<tr>
<td align="right">kategorie:</td>
<td bgcolor="#CCCCFF">
<input type="text" name="cat" style="width:200px;">
</td>
</tr>
<tr>
<td align="right">bild:</td>
<td bgcolor="#CCCCFF">
<input type="file" name="fileinput" style="width:200px;">
</td>
</tr>
<tr>
<td align="right">Type:</td>
<td bgcolor="#CCCCFF">
<input type="text" name="type" style="width:200px;">
</td>
</tr>
<tr>
<td align="right"> </td>
<td bgcolor="#CCCCFF">
<input type="submit" name="submit" value="Eintragen!">
</td>
</tr>
</table>
</form>
</td>
</tr>
</table>
<?
require("footer.php3");
?>
Hier die header.inc:
<?
mysql_pconnect ("localhost", "root", "") or mysql_die();
?>
<html>
<head>
<title>Bilder</title>
<head>
<body bgcolor="#000041" text="#ffffff">
<div align="center">
Die footer.php3:
</div>
</body>
</html>
Die image.php3:
<?
require("header1.inc");
$SQL = "select body,type from bin where title='$title'";
$Show = mysql ( $hDB, $hSQL );
$Rows = mysql_num_rows($hShow);
$Rows<1){
// no image matches this query
}
else{
// at least one image has this title
$getPhoto = mysql_fetch_object($Show);
// we need to determine the mime type
$Type = $getPhoto->type;
// and send the correct header to the browser
Header("Content-type: $Type");
// now send the image
$Body = $ge
tPhoto->body;
echo $Body;
flush();
}
?>
Die viewbanner.php3
<?
/* $Id: viewbanner.php3,v 1.6 1999/03/18 16:10:42 tobias Exp $ */
require("header1.inc");
$res = mysql_db_query(test, "SELECT * FROM bin", $link) or mysql_die();
if (mysql_num_rows($res) == 0)
{
echo "No Images";
}
else
{
$row = mysql_fetch_array($res);
Header( "Content-type: image/$row[type]");
echo $row[body];
}
?>
Die header1.inc hat nur folgenden Zusatz:
$link = mysql_pconnect(..........)
Danke in voraus und viel Spass im Schwimmbad.
Olaf
---
*** Abmelden von dieser Mailingliste funktioniert per E-Mail
*** an mysql-de-request_(at)_lists.4t2.com mit Betreff/Subject: unsubscribe
php::bar PHP Wiki - Listenarchive