Hola amigos, saben que me he creado un upload para mi web, funciona perfectamente, solo que me gustaria que me ayuden a editar unos codigos, asi me queda de lujo (H), pero enverdad me da 1 error, cuando no selecciono ningun archivo a subir y le doy upload, deveria aparecer un texto como este: Ningun archivo seleccionado, y no aparece nada y ademas tingo otro problema, yo quiero que solo se puedan subir estos tipos de archivos: jpg,jpeg,png,gif,bmp y solo se pueden algunos, y otro problem, cuando subo el archivo me aparece todo correctamente, solo que arriva me sigue apareciendo para subir mas imagenes y yo quiero que cuando termine de subir la imagen desaparesca eso, solo esos son los errores, muchos mas de los que dije xdd, son 3 errores quisiera que me ayudaran a resolverlos, mi codigo php es este:
<?php
$varrand = substr(md5(uniqid(rand())),0,10);
$varallw = $varallw = array("image/bmp","image/gif","image/jpeg","image/pjpeg","image/png","image /x-png");
$varpath = "https://proupload-1.webcindario.com/img/";
$varstat = "";
if ($_POST["action"] == "upload") {
if (is_uploaded_file($_FILES["imagen"]["tmp_name"])) {
$varname = $_FILES["imagen"]['name'];
$vartemp = $_FILES['imagen']['tmp_name'];
$vartype = $_FILES['imagen']['type'];
if (in_array($vartype, $varallw) && $varname != "") {
$arrname = explode(".", $varname);
$varname = $varrand.".".$arrname[1];
if (copy($vartemp, "img/".$varname)) {
$varpath = $varpath.$varname;
$varstat = "ok";
} else {
$varstat = "Error al subir el archivo.";
}
} else {
$varstat = "Tipo de archivo no valido.";
}
}
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>ProUpload ~ Servidor 1</title>
<link href="style-def.css" rel="stylesheet" type="text/css" />
<body background="fondo.png">
</head>
<body>
<table width="420" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="413" height="40"><span style="font-size: small"><strong>ProUpload ~ Servidor 1</strong></span></td>
</tr>
<tr>
<td>Tu Hosting de Imagenes</td>
</tr>
<tr>
<form action="upload.php" method="post" enctype="multipart/form-data">
<td height="50" valign="top">
<input name="imagen" type="file" id="imagen" size="35" />
<input name="enviar" type="submit" id="enviar" value="Subir Imagen" />
<input name="action" type="hidden" value="upload" /> </td>
</form>
</tr>
<td>Maximo peso: 1 MB.<br />
Tipos de archivos: jpg,jpeg,png,gif,bmp.</td>
<?php if ($varstat == "ok") { ?>
<tr>
<td><img alt="" src="linea.png" /><br /><strong>Confirmación:</strong><br>
Archivo subido satisfactoriamente. Puedes utilizar las siguientes opciones para enlazarlo:<br>
<strong>Enlace Directo:</strong><br>
<input name='txt1' type='text' onClick="javascript:select();" value='<?php echo $varpath; ?>' size='60'>
<br>
<strong>Enlace Para ver la IMG:</strong><br>
<input name='txt2' type='text' onClick="javascript:select();" value='https://proupload-1.webcindario.com/view.php?image=<?php echo $varname; ?>' size='60'>
<br>
<strong>Enlace HTML:</strong><br>
<input name='txt3' type='text' onClick="javascript:select();" value='<a href="https://proupload-1.webcindario.com/view.php?image=<?php echo $varname; ?>"><img src="<?php echo $varpath; ?>" border="0" /></a>' size='60'>
<br>
<strong>Enlace BBCode:</strong><br>
<input name='txt4' type='text' onClick="javascript:select();" value='[URL=https://proupload-1.webcindario.com/view.php?image=<?php echo $varname; ?>][img]<?php echo $varpath; ?>[/img][/URL]' size='60'></td>
</tr>
<?php } else { ?>
<?php if ($varstat != "") { ?>
<tr>
<td><img alt="" src="linea.png" /><br /><strong>Error:</strong><br>
<?php echo $varstat; ?></td>
</tr>
<?php } ?>
<?php } ?>
</table>
<?php if ($varstat == "ok") { ?>
<p align="center"><br /><span style="font-size: 1px"> </span><a target="_blank" href="<?php echo $varpath; ?>"><img alt="<?php echo $_GET['image']; ?>" height="100" src="img/<?php echo $varname; ?>"></a></p>
<?php } ?>
<?php if ($_GET['image'] != "") { ?>
<p align="center"><br /><span style="font-size: 1px"> </span><a target="_blank" href="<?php echo $varpath; ?>"><img alt="<?php echo $_GET['image']; ?>" height="100" src="img/<?php echo $_GET['image']; ?>"></a></p>
<?php } ?>
</body>
</html>
Ese es, les dejo mi web en el codigo por cualquier cosa, adios.
Desde ya Gracias.