Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Dateiupload in Mysql schlägt fehl..

1 view
Skip to first unread message

Andreas Vogt

unread,
Nov 10, 2009, 1:53:45 AM11/10/09
to
Hallo,

habe schon viele Foren durchforstet und die üblichen Parameter gesetzt.

Ich möchte Dateien in eine MYSQL Datenbank hochladen.
Bis 2MB geht das, darüber kommt folgender Fehler:
Warning: fopen() [function.fopen]: Filename cannot be empty in
C:\Inetpub\meros\frames\content\partner\results_upload.php on line 37
Warning: fread(): supplied argument is not a valid stream resource in
C:\Inetpub\meros\frames\content\partner\results_upload.php on line 37

Die Werte in der php.ini:
post_max_size=32M
upload_max_filesize=32
Mmemory_limit = 128M

Das Script:
include ("db_parameter.php");
// Datenbankverbindung aufbauen
$connectionid = mysql_connect($DB_HOST, $DB_USER, $DB_PW)or die("Keine
Verbindung möglich: " . mysql_error());

mysql_select_db($DB_NAME) or die("Auswahl der Datenbank fehlgeschlagen");
if (!mysql_select_db ($DB_NAME, $connectionid))
{
die ("Keine Verbindung zur Datenbank");
}
?>
<html>
<head>
<link rel="stylesheet" type="text/css"
href="../../../css/formate_content.css">

<title>MEROS Project</title>
<base target="Content">
</head><body>
<P><BR>
<blockquote>
<?php

if (isset($submiter))
$zahl1=1;
else
$submiter = false;

if ($submiter) {
$data = addslashes(fread(fopen($form_data, "r"), filesize($form_data)));
// Das ist Zeile 37!
$arrFilename=array();
$pos=strrpos($form_data_name,".");
$arrFilename['name']=substr($form_data_name,0,$pos);
$arrFilename['ext']=substr($form_data_name,$pos+1,strlen($form_data_name));
$FILETYPE_tmp = $form_data_type;
if ($arrFilename['ext']== "xls") $FILETYPE_tmp = "application/vnd.ms-excel";
if ($arrFilename['ext']== "doc") $FILETYPE_tmp = "application/vnd.msword";
if ($arrFilename['ext']== "ppt") $FILETYPE_tmp =
"application/vnd.ms-powerpoint";
if ($arrFilename['ext']== "pdf") $FILETYPE_tmp = "application/pdf";
if ($arrFilename['ext']== "doc") $FILETYPE_tmp = "application/vnd.msword";
if ($arrFilename['ext']== "zip") $FILETYPE_tmp = "application/zip";
$result=MYSQL_QUERY("INSERT INTO results
(beschreibung,bin_data,filename,filesize,filetype, user, datum) ".
"VALUES
('".$_REQUEST["form_beschreibung"]."','$data','$form_data_name','$form_data_size','$FILETYPE_tmp',
".$_SESSION["user_id"].",now())");

$id= mysql_insert_id();


MYSQL_CLOSE();
}
?>
<font face="Arial" size="2">Hochladen eines Dokuments auf die
Projektseite:<BR><BR>
Dateigröße bitte max. 10MB! Bitte ZIP-Tools nutzen!<BR><BR>
<form method="post" action="results_upload.php"
enctype="multipart/form-data">
<font face="Arial" size="2">Beschreibung:<br>
<input type="text" name="form_beschreibung" size="40">
<input type="hidden" name="MAX_FILE_SIZE" value="4097152"><br><BR>
<font face="Arial" size="2">Datei auswählen:<br>
<input type="file" name="form_data" size="40">
<p><input type="submit" name="submiter" value="upload">
</form>

</Blockquote>
</body>
</html>

Woran könnte das noch liegen?
In der DB ist das Feld "bin_data" ein LONGBLOB.

Gruß

Andreas Vogt


Claus Reibenstein

unread,
Nov 10, 2009, 2:13:48 AM11/10/09
to
Andreas Vogt schrieb:

> upload_max_filesize=32

upload_max_filesize = 32M

Gruß. Claus

Andreas Vogt

unread,
Nov 10, 2009, 2:30:10 AM11/10/09
to
Jip, hatte beim copy&paste ins Email das "M" unterschlagen, steht so in der
php.ini...


Dominik Echterbruch

unread,
Nov 10, 2009, 3:45:36 AM11/10/09
to
Andreas Vogt wrote:
>
> Ich möchte Dateien in eine MYSQL Datenbank hochladen.
> Bis 2MB geht das, darüber kommt folgender Fehler:
> Warning: fopen() [function.fopen]: Filename cannot be empty in
> C:\Inetpub\meros\frames\content\partner\results_upload.php on line 37
> Warning: fread(): supplied argument is not a valid stream resource in
> C:\Inetpub\meros\frames\content\partner\results_upload.php on line 37
>
> Die Werte in der php.ini:
> post_max_size=32M
> upload_max_filesize=32
> Mmemory_limit = 128M

Schon mal geschaut, ob die Werte auch in der Umgebung gelten, in der du
unterwegs bist? phpinfo() ist dein Freund. Guck mal ein, ob nicht
vielleicht durch einen Eintrag im Apache diese Werte überschrieben werden.

Grüße,
Dominik
--
Wo kämen wir hin, wenn alle sagten, wo kämen wir hin, und niemand
ginge, um einmal zu schauen, wohin man käme, wenn man ginge.
Autor: Kurt Marti (http://de.wikiquote.org/wiki/Kurt_Marti)

Andreas Vogt

unread,
Nov 10, 2009, 4:21:50 AM11/10/09
to
Hi,

klar habe ich als erstes getestet.
Läuft übrigens aufm IIS6

phpinfo:
Loaded Configuration File C:\WINDOWS\php.ini
file_uploads On
max_execution_time 60
post_max_size 64M
upload_max_filesize 32M
upload_tmp_dir no value
memory_limit 128M
max_input_time 120

Dominik Echterbruch

unread,
Nov 10, 2009, 5:43:11 AM11/10/09
to
Andreas Vogt wrote:
>
> klar habe ich als erstes getestet.
> Läuft übrigens aufm IIS6

Ah, OK. Microsoft und brauchbare Webanwendungen passen für mich
gedanklich immer noch nicht so recht zusammen ;)

> phpinfo:
> Loaded Configuration File C:\WINDOWS\php.ini
> file_uploads On
> max_execution_time 60
> post_max_size 64M
> upload_max_filesize 32M
> upload_tmp_dir no value
> memory_limit 128M
> max_input_time 120

Sind das die globalen oder die lokalen Werte? Zumindest auf einem Apache
wird das zweispaltig angezeigt und liefert beide Werte. Wie es mit dem
IIS ist, weiß ich nicht.

Andreas Vogt

unread,
Nov 10, 2009, 6:33:32 AM11/10/09
to
Die lokalen und Masterwerte sind identisch - habe daher nur einmal den Wert
gepostet..


Claus Reibenstein

unread,
Nov 10, 2009, 7:27:26 AM11/10/09
to
Andreas Vogt schrieb:

> max_execution_time 60
> max_input_time 120

Wie lange dauert denn der Upload einer 2MB-Datei? Eventuell läuft da
irgendwo irgendein Timer ab.

Nur mal so als Idee.

Gruß. Claus

Andreas Vogt

unread,
Nov 10, 2009, 9:09:58 AM11/10/09
to
Server und Client sind im selben 1000Mbit Intranet - dauert keine Sekunde..


Dominik Echterbruch

unread,
Nov 10, 2009, 9:34:10 AM11/10/09
to
Andreas Vogt wrote:
>
> Ich möchte Dateien in eine MYSQL Datenbank hochladen.
> Bis 2MB geht das, darüber kommt folgender Fehler:
> Warning: fopen() [function.fopen]: Filename cannot be empty in
> C:\Inetpub\meros\frames\content\partner\results_upload.php on line 37
> Warning: fread(): supplied argument is not a valid stream resource in
> C:\Inetpub\meros\frames\content\partner\results_upload.php on line 37

Grad noch eine andere Idee: Hast du möglicherweise nur noch ca. 2 MB
Platz auf der Platte, wo die Datei temporär abgelegt wird? Oder gibt es
beim IIS einen ca. 2 MB großen RAM-Cache für die hochgeladenen Dateien,
sodass die fehlenden Schreibrechte im temporären Verzeichnis erst bei
größeren Dateien auffallen?

Andreas Vogt

unread,
Nov 10, 2009, 9:32:21 AM11/10/09
to
Hi,

also auf der Platte (Client und Server) sind mehrere hunder GB frei..

Im IIS habe ich keine solche Einstellung gefunden, das Temp-Sir
c:\windows\temp hat auch keine Kontingente oder so..

leider...

0 new messages