BomberJack
Erfahrenes Mitglied
Hi all,
ich habe ein skript zum datei uploaden und möchte dies so erweitern das zusätzliche Formulardaten und der dateipfad in einer mysql db gespeichert wird das ich dies dann bequem abrufen kann.
Mein skript sieht momentan so aus wobei ich in einer config datei die größe,pfad und dateiendung festlege. Ich hoffe es kann mir jemand helfen weil ich keine ahnung hab wie ich das in eine mysql speichern kann
Schonmal vielen dank
Gruß
BomberJack
ich habe ein skript zum datei uploaden und möchte dies so erweitern das zusätzliche Formulardaten und der dateipfad in einer mysql db gespeichert wird das ich dies dann bequem abrufen kann.
Mein skript sieht momentan so aus wobei ich in einer config datei die größe,pfad und dateiendung festlege. Ich hoffe es kann mir jemand helfen weil ich keine ahnung hab wie ich das in eine mysql speichern kann

PHP:
<?
switch($upload) {
default:
include "config.php";
echo "
<html>
<head>
<title>Upload</title>
</head>
<body topmargin=\"10\" leftmargin=\"0\" bgcolor=\"#18576F\" link=\"#818EA0\" vlink=\"#5C697A\" alink=\"#818EA0\" text=\"#FFFFFF\" style=\"font-family: Verdana; font-size: 8pt; color: #FFFFFF\">
<div align=\"center\">
<center>
<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-collapse: collapse\" bordercolor=\"#111111\" width=\"400\" id=\"AutoNumber1\">
<tr>
<td bgcolor=\"#5E6A7B\" height=\"25\">
<p align=\"center\"><font size=\"2\"><b>Upload File</b></font></td>
</tr>
<tr>
<td bgcolor=\"#818EA0\"><font size=\"2\">Folgendes ist zu beachten:</font><ul type=\"square\">
<li><font size=\"2\">Dateiname darf nur <b>";
if (($extensions == "") or ($extensions == " ") or ($ext_count == "0") or ($ext_count == "") or ($limit_ext != "yes") or ($limit_ext == "")) {
echo "*.rep,*.zip,*.rar sein";
} else {
$ext_count2 = $ext_count+1;
for($counter=0; $counter<$ext_count; $counter++) {
echo " $extensions[$counter]";
}
}
if (($limit_size == "") or ($size_limit != "yes")) {
$limit_size = "any size";
} else {
$limit_size .= " bytes";
}
echo"</b></font></li>
<li><font size=\"2\">Maximale Dateigröße ist $limit_size</font></li>
<li><font size=\"2\">Keine Leerzeichen im Dateinamen</font></li>
</li>
</ul>
<table border=\"1\" cellpadding=\"0\" cellspacing=\"2\">
<tr>
<td>Sieger</td>
<td>Verlier</td>
</tr>
<tr>
<td><input type=\"text\" name=\"winnername\" size=\"24\" value=\"Nickname\"></td>
<td><input type=\"text\" name=\"loosername\" size=\"24\" value=\"Nickname\"></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td>Map:</td>
<td><select name=\"selectName\" size=\"1\">
<option value=\"1\">Testmap1</option>
<option value=\"2\">testmap2</option>
<option value=\"3\">testmap3</option>
</select></td>
</tr>
<tr>
<td>Zeit ca.</td>
<td>
<table border=\"1\" cellpadding=\"0\" cellspacing=\"2\" width=\"72\">
<tr>
<td><input type=\"text\" name=\"textfieldName\" size=\"10\"></td>
<td>min</td>
</tr>
</table>
</td>
</tr>
</table>
</form>
<form method=\"POST\" action=\"$PHP_SELF?upload=doupload\" enctype=\"multipart/form-data\">
<p align=\"center\">
<input type=file name=file size=30 style=\"font-family: v; font-size: 10pt; color: #5E6A7B; border: 1px solid #5E6A7B; padding-left: 4; padding-right: 4; padding-top: 1; padding-bottom: 1\"><br>
<br>
<button name=\"submit\" type=\"submit\" style=\"font-family: v; font-size: 10pt; color: #5E6A7B; border: 1px solid #5E6A7B; padding-left: 4; padding-right: 4; padding-top: 1; padding-bottom: 1\">Hochladen</button>
</p>
</form>
<p>
</td>
</tr>
</table>
</center>
</div>
</body>
</html>";
break;
case "doupload":
include "config.php";
$endresult = "<font size=\"2\">Replay/zip/rar Datei hochgeladen</font>";
if ($file_name == "") {
$endresult = "<font size=\"2\">Keine Datei ausgewählt</font>";
}else{
if(file_exists("$absolute_path/$file_name")) {
$endresult = "<font size=\"2\">Diese Datei gibt es bereits auf dem Server</font>";
} else {
if (($size_limit == "yes") && ($limit_size < $file_size)) {
$endresult = "<font size=\"2\">Dateigröße zu groß</font>";
} else {
$ext = strrchr($file_name,'.');
if (($limit_ext == "yes") && (!in_array($ext,$extensions))) {
$endresult = "<font size=\"2\">Dies ist keine Replay/zip/rar Datei</font>";
}else{
@copy($file, "$absolute_path/$file_name") or $endresult = "<font size=\"2\">Kann Datei nicht kopieren</font>";
}
}
}
}
echo "
<html>
<head>
<title>Replay Upload</title>
</head>
<body topmargin=\"10\" leftmargin=\"0\" bgcolor=\"#18576F\" link=\"#818EA0\" vlink=\"#5C697A\" alink=\"#818EA0\" text=\"#FFFFFF\" style=\"font-family: Verdana; font-size: 8pt; color: #FFFFFF\">
<div align=\"center\">
<center>
<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"border-collapse: collapse\" bordercolor=\"#111111\" width=\"400\" id=\"AutoNumber1\">
<tr>
<td bgcolor=\"#5E6A7B\" height=\"25\">
<p align=\"center\"><font size=\"2\"><b>Replay hochladen</b></font></td>
</tr>
<tr>
<td bgcolor=\"#818EA0\">
<center> $endresult </center>
</td>
</tr>
<tr>
<td bgcolor=\"#5E6A7B\" height=\"25\">
<p align=\"center\"><font size=\"1\">
</tr>
</table>
</center>
</div>
</body>
</html>";
break;
}
?>
Schonmal vielen dank
Gruß
BomberJack