Avatar Image
Usuario habitual
Usuario habitual

no puedo subir zips con este script

<form action="" method="post" enctype="multipart/form-data" name="form" id="form">
<input name="archivo" type=file id="archivo">
<input name="submit" type=submit value=Upload>
<input type="reset" name="Reset" value="Borrar">
</form>
<?php
$extensiones=array("zip&quot;
$dbuser="root"; //usuario de la base de datos
$dbpass="root2512"; // password para la base
if (isset($_FILES['archivo']['name'])){ // si estoy subiendo el archivo o es la primera carga de la pagina
$path="codigo/"; // path adonde la voy a guardar, en este caso mi_ubicacion_actual/imagenes
$nombre=$_FILES['archivo']['name'];
$tamanio=$_FILES['archivo']['size'];
$tipo=$_FILES['archivo']['type'];
$var = explode(".","$nombre&quot;
$num = count($extensiones);
$valor = $num-1;
$admitido=false;
for($i=0; $i<=$valor; $i++) {
if($extensiones[$i] == $var[1]) {
$admitido=true;//es una extension valida
break;
}
}
if ($admitido){
/* $link=mysql_connect("localhost",$dbuser,$dbpass);
mysql_select_db("test&quot;
$tamanio=round($tamanio/1024,0); //redondeo y paso a kb
$sql="Insert Into pics (tipo,size,path) values ('" .$tipo. "'," .$tamanio. ",'" .$path. "')";
mysql_query($sql);
$lastid=mysql_insert_id();
$path.=$lastid . "-" . $nombre;
$sql="Update pics set path='" . $path . "' Where id=$lastid";
mysql_query($sql); */
$path="codigo/algo.zip";
if (is_uploaded_file($_FILES['archivo']['tmp_name']))
{
copy($_FILES['archivo']['tmp_name'], "$path&quot;?>
<font color="#CCCCCC" size="2" face="Verdana, Arial, Helvetica, sans-serif">El
archivo se ha subido correctamente al servidor.</font>
<?php
/*if (mysql_affected_rows($link)==0)*/{?>
<font color="#CCCCCC" size="2" face="Verdana, Arial, Helvetica, sans-serif">Ocurrio un error guardando
en la base de datos. </font>
<?php
}
}
else
{ ?>
<font color="#CCCCCC" size="2" face="Verdana, Arial, Helvetica, sans-serif">Error
al subir el archivo.</font>
<?php
}


}else{?>
<font color="#CCCCCC" size="2" face="Verdana, Arial, Helvetica, sans-serif">Tipo
de archivo no admitido, debe ser .jpg &oacute; .jpeg</font>
<?php
}
}

?>

3dxtreme
Usuario Novato
Usuario Novato

sorry i can\'t write in spanish but if you can read that, i guess your problem could be that function is_uploaded_file in this line:

Escrito originalmente por rccroot
no puedo subir zips con este script

if (is_uploaded_file($_FILES[\'archivo\'][\'tmp_name\']))
{
copy($_FILES[\'archivo\'][\'tmp_name\'], \"$path\";?>



im writing a system for uploading too (images in my case) and I tested it exaustivelly with that function above and was only giving me FALSE for the upload process but then with only \'move_uploaded_file\' it gives to me success and everything is handed fine.. I dont know neither want to why this frikin function give us that but if this is your case too use this other, there are many other ways to avoid invaders (even more because mi@ is already in safe mode)

hope that works
eduardo - brazil
Avatar Image
@man / @woman
@man / @woman

Aquí hay un script, pero no lo he probado, pero pone que funciona en mi@.

http://electros.iefactory.com/?ver=scripts&s=7


Here's a script to do that, but I didn't try, but it's said that work in mi@.

Avatar Image
Usuario Novato
Usuario Novato
No uses la función copy mejor usa move_uploaded_file() con esa me sirvio por que con copy si la seguridad esta activada no te lo vale y move_uploaded_file se brinca la seguridad.
ATENCIÓN: Este tema no tiene actividad desde hace más de 6 MESES,
te recomendamos abrir un nuevo tema en lugar de responder al actual
Opciones:
Ir al subforo:
Permisos:
TU NO PUEDES Escribir nuevos temas
TU NO PUEDES Responder a los temas
TU NO PUEDES Editar tus propios mensajes
TU NO PUEDES Borrar tus propios mensajes
Temas similares
TemaUsuariosRespuestasVisitasActividad
Por: , el 25/Feb/2010, 03:45
FoZFoRo thebiglucas aerialss8833kMar/10
Por: , el 16/Nov/2009, 04:41
byds Yamil_Rodriguez12kNov/09
Por: , el 21/Jun/2008, 18:44
juanicho8 TheBlackWolf NoSetup.org42kJun/08
Por: , el 15/Dic/2003, 01:58
Daneel Electros NoSetup.org vidasimpson43kDec/03
Por: , el 01/May/2003, 06:22
blancoyplata x-lord GeoMX54kMay/03