Hallo,
ich verzweifele langsam...
ich benötige einen Dateiupload und bekomme die Daten nicht auf den Server (IIS) . Wenn ich mir 3 Seiten bastele und das ausserhalb meine Anwendung teste, dann funktioniert das problemlos...
In meinem Formular, geht letztlich darum den Dateiupload zu machen und anschließend in die Datenbank zu übertragen..
Mein Problem ist, dass die Funktion upload offensichtlich nicht ausgeführt wir ... oder zu früh...
Kann mir jemand helfen??
Gruß haverc
Die entsprechenden Abschnitte:
PHP-Code:
<?php function showroweditor($row, $iseditmode)
{
global $conn;
?>
<table class="tbl" border="0" cellspacing="1" cellpadding="5"width="50%">
<tr>
<td class="hr"><?php echo htmlspecialchars("kataster_nr")." " ?></td>
<!--td class="dr"><?php echo htmlspecialchars($row["kataster_nr"]) ?></td-->
<td class="dr"><input type="text" name="kataster_nr" value="<?php echo str_replace('"', '"', trim($row["kataster_nr"])) ?>"></td>
</tr>
<tr>
<td class="hr"><?php echo htmlspecialchars("name")." " ?></td>
<td class="dr"><textarea cols="35" rows="4" name="name" maxlength="255"><?php echo str_replace('"', '"', trim($row["name"])) ?></textarea></td>
</tr>
<tr>
[B]<td class="hr"><?php echo htmlspecialchars("handelsname")." " ?></td>
<td class="dr"><textarea cols="35" rows="4" name="handelsname" maxlength="1000"><?php echo str_replace('"', '"', trim($row["handelsname"])) ?></textarea></td>
<td>
<input type="hidden" name="MAX_FILE_SIZE" value="100000">
Datei uebertragen: <input type="file" name="datei" size="40" maxlength="1000000">
<!--input type="submit" name="Submit" value="Senden"-->
</td> [/B]<!--td><a href="up_form.html" target="_blank"><img src="..\files\image\3p.gif" ></a></td-->
</tr>
<tr>
<td class="hr"><?php echo htmlspecialchars("hersteller")." " ?></td>
<td class="dr"><textarea cols="35" rows="4" name="hersteller" maxlength="255"><?php echo str_replace('"', '"', trim($row["hersteller"])) ?></textarea></td>
</tr>
<tr>
<td class="hr"><?php echo htmlspecialchars("lieferant")." " ?></td>
<td class="dr"><textarea cols="35" rows="4" name="lieferant" maxlength="255"><?php echo str_replace('"', '"', trim($row["lieferant"])) ?></textarea></td>
</tr>
<tr>
<td class="hr"><?php echo htmlspecialchars("bemerkung")." " ?></td>
<td class="dr"><textarea cols="35" rows="4" name="bemerkung" maxlength="255"><?php echo str_replace('"', '"', trim($row["bemerkung"])) ?></textarea></td>
</tr>
<tr>
........
</tr>
<tr>
<td class="hr"><?php echo htmlspecialchars("mailstop")." " ?></td>
<td class="dr"><textarea cols="35" rows="4" name="mailstop" maxlength="1000"><?php echo str_replace('"', '"', trim($row["mailstop"])) ?></textarea></td>
</tr>
</table>
<?php } ?>
PHP-Code:
<?php function editrec($recid)
{
if (!login_edit($recid)) exit;
$res = sql_select();
$count = sql_getrecordcount();
@pg_result_seek($res, $recid);
$row = pg_fetch_assoc($res);
showrecnav("edit", $recid, $count);
?>
<br>
<form enctype="multipart/form-data" action="gkataster.php" method="post">
<input type="hidden" name="sql" value="update">
<input type="hidden" name="xkataster_nr" value="<?php echo $row["kataster_nr"] ?>">
<?php showroweditor($row, true); ?>
<input type="submit" name="Submit" value="Senden" >
<p><input type="submit" name="action" value="Uebertragen"></p>
</form>
<?php
pg_free_result($res);
} ?>
PHP-Code:
function upload()
{
// Prüfen des Arrays $_FILES
if (isset($_FILES["datei"])) {
// Upload-Status
if ($_FILES["datei"]["error"] == UPLOAD_ERR_OK) {
// Muster zur Überprüfung der im Dateinamen
// enthaltenen Zeichen (Optional)
// $regExp = "/^[a-z_]([a-z0-9_-]*\.?[a-z0-9_-])*\.[a-z]{3,4}$/i";
// Dateiname und Dateigröße
if (preg_match($regExp,$_FILES["datei"]["name"]) && $_FILES["datei"]["size"] > 0 && $_FILES["datei"]["size"] < 1000000) {
// Temporäre Datei in das Zielverzeichnis
// des Servers verschieben.
move_uploaded_file($_FILES["datei"]["tmp_name"],$_FILES["datei"]["name"]);
// Redirect zur Erfolgsmeldung
// header("Location: status.html");
}
else {
echo "Fehler: Im Dateinamen oder Dateigrössen Limit!";
}
}
else {
echo "Fehler: Während der Übertragung aufgetreten!";
}
}
else {
echo "Fehler: Dateiupload fehlgeschlagen!";
}
}