hallo hallo...und danke für die rasend schnelle antwort!
also ich habe hier so ein skript aus dem internet gezogen, welches auch bis auf den download funktionier....
wenn ich auf den download link klicke, passiert nichts.....
add.php
download.php
main.php
und das ganze kommt von hier->
http://www.onlamp.com/pub/a/php/2000...php_mysql.html
kann mir jemand sagen wiso ich nicht download kann!?
danke cheers
also ich habe hier so ein skript aus dem internet gezogen, welches auch bis auf den download funktionier....
wenn ich auf den download link klicke, passiert nichts.....
add.php
PHP-Code:
<?php
if ($action == "upload") {
// ok, let's get the uploaded data and insert it into the db now
include "open_db.inc";
if (isset($binFile) && $binFile != "none") {
$data = addslashes(fread(fopen($binFile, "r"), filesize($binFile)));
$strDescription = addslashes(nl2br($txtDescription));
$sql = "INSERT INTO tbl_Files ";
$sql .= "(description, bin_data, filename, filesize, filetype) ";
$sql .= "VALUES ('$strDescription', '$data', ";
$sql .= "'$binFile_name', '$binFile_size', '$binFile_type')";
$result = mysql_query($sql, $db);
@mysql_free_result($result); // it's always nice to clean up!
echo "Thank you. The new file was successfully added to our database.<br><br>";
echo "<a href='main.php'>Continue</a>";
}
mysql_close();
} else {
?>
<HTML>
<BODY>
<FORM METHOD="post" ACTION="add.php" ENCTYPE="multipart/form-data">
<INPUT TYPE="hidden" NAME="MAX_FILE_SIZE" VALUE="1000000">
<INPUT TYPE="hidden" NAME="action" VALUE="upload">
<TABLE BORDER="1">
<TR>
<TD>Description: </TD>
<TD><TEXTAREA NAME="txtDescription" ROWS="10" COLS="50"></TEXTAREA></TD>
</TR>
<TR>
<TD>File: </TD>
<TD><INPUT TYPE="file" NAME="binFile"></TD>
</TR>
<TR>
<TD COLSPAN="2"><INPUT TYPE="submit" VALUE="Upload"></TD>
</TR>
</TABLE>
</FORM>
</BODY>
</HTML>
<?php
}
?>
PHP-Code:
<?php
if ($id_files) {
include "open_db.inc";
$sql = "SELECT bin_data, filetype, filename, filesize FROM tbl_Files WHERE id_files=$id_files";
$result = @mysql_query($sql, $db);
$data = @mysql_result($result, 0, "bin_data");
$name = @mysql_result($result, 0, "filename");
$size = @mysql_result($result, 0, "filesize");
$type = @mysql_result($result, 0, "filetype");
header("Content-type: $type");
header("Content-length: $size");
header("Content-Disposition: attachment; filename=$name");
header("Content-Description: PHP Generated Data");
echo $data;
}
?>
PHP-Code:
<?php
include "open_db.inc";
$sql = "SELECT * FROM tbl_Files ";
$sql .= "ORDER BY filename ASC";
$result = mysql_query($sql, $db);
$rows = mysql_num_rows($result);
echo "<table>\n";
echo " <tr>\n";
echo " <td>Filename</td>\n";
echo " <td>Type</td>\n";
echo " <td>Size</td>\n";
echo " <td>Description</td>\n";
echo " <td> </td>\n";
echo " </tr>\n";
for ($i = 0; $i < $rows; $i++) {
$data = mysql_fetch_object($result);
// since our script is very small, i'm not going to escape out to html mode here
echo " <tr>\n";
echo " <td>$data->filename</td>\n";
echo " <td>$data->filetype</td>\n";
echo " <td>$data->filesize</td>\n";
echo " <td>" . stripslashes($data->description) . "</td>\n";
echo " <td>( <a href='download.php?id=$data->id_files'>Download</a> )</td>\n";
echo " </tr>\n";
}
//mysql_free_result($result);
mysql_close($db);
?>
http://www.onlamp.com/pub/a/php/2000...php_mysql.html
kann mir jemand sagen wiso ich nicht download kann!?
danke cheers
Kommentar