Código PHP:
<?php
if ($_POST['Submit']) {
$currentdir=getcwd();
$target_file = "/images/".$_POST['Seleccion']."/" . basename($_FILES['Image']['name']);
$target_path = $currentdir.$target_file;
$image_link;
if (move_uploaded_file($_FILES['Image']['tmp_name'], $target_path)) {
$image_link = "releasebox".$target_file;
$db = mysql_pconnect("localhost", "bd", "password");
mysql_select_db("nanikano_addons", $db);
$sql = "INSERT INTO ".$_POST['Seleccion']." (name, image) VALUES ('".$_POST['Name']."', '".$image_link."')";
$result = mysql_query($sql);
include ("imagen_incluida.php");
} else {
echo "Error al subir el fichero.<br>";
echo mysql_error();
}
} else{
?>
<form method="post" action="<?php echo $PHP_SELF?>">
<table>
<tr>
<td colspan="2"><H1 align="left">Añadir una nueva imagen</H1></td>
</tr>
<tr>
<td width="25%"><span class="style1">Título:</span></td>
<td width="75%"><input type="text" name="Name" size="60" /> </input></td>
</tr>
<tr>
<td><span class="style1">Imagen:</span></td>
<td><input type="file" name="Image" size="60" /></input></td>
</tr>
<tr>
<td><INPUT TYPE="radio" NAME="Seleccion" VALUE="series"><span class="style1">Serie</span></td>
<td><INPUT TYPE="radio" NAME="Seleccion" VALUE="caps"><span class="style1">Capitulo</span></td>
</tr>
<tr>
<td colspan="2"><br /></td>
</tr>
<tr>
<td><input type="Submit" name="Submit" value="Enviar"></td>
<td><input type="reset" name="reset" value="Borrar"></td>
</tr>
</table>
</form>
<?php }
?>