Ver Mensaje Individual
  #1 (permalink)  
Antiguo 28/07/2006, 19:00
the_newie
 
Fecha de Ingreso: julio-2006
Ubicación: Buenos Aires-Cap. Fed.
Mensajes: 12
Antigüedad: 17 años, 8 meses
Puntos: 0
Pregunta Multiple upload + indicar carpeta del mismo

Buenas a todos, la verdad que el foro esta barbaro, mi nombre es Sergio, soy diseñador web y estoy aprendiendo php, desde ya mi nivel es masque basico y quisiera decir antes de postear mi duda-problema que revise al rededor de 28 post con la palabra clave "upload" y aun asi no pude conseguir nada, tambien eche un vistaso al manual oficial de php pero esta en ingles y eso me mata :S , por eso quisiera agradecer de antemano a todos aquellos que puedan ayudarme , desde ya muchas gracias.

Mi duda es la siguiente:

¿Como puedo hacer para subir 10 archivos a una carpeta desiganada por un usuario?

Tengo el php que sube los multiples archivos ("sube archivos") y tengo el php que sube un archivo a la carpeta designada por el usuario en el campo nombre ("sube archivos en carpeta designada") mi problema es que al quererlos convinar me salen un sin fin de errores...

a continuacion los phps que estoy trabajando:

..........................SUBE ARCHIVOS....................................


<?php

$path=$_SERVER['DOCUMENT_ROOT'].'/archivos/';

/* Destination of Upload files..use / insted of \\\\\\\\ in UNIX */
define($path,'cena2005');

/* Signamos a UPLOAD_NO la cantidad de infiles que queremos hacer */
define(UPLOAD_NO, 10);

if($REQUEST_METHOD!=POST)
{
print '<form enctype=multipart/form-data method=POST>';
print '<INPUT TYPE=hidden name=MAX_FILE_SIZE value=100000>';

for($i=1; $i<=UPLOAD_NO; $i++)
{
echo '<input type=file name=infile';echo$i;echo'>';

if($i%2==0)
print'<br>';
}
echo '<br><br><input type=submit value=Subir></form>';
}
else
{
/* handle uploads */
$noinput = true;
for($i=1; $noinput && ($i<=UPLOAD_NO); $i++)
{
if(${infile.$i}!=none) $noinput=false;
}
if($noinput)
{
print '<big><B>Error uploading. Intente de Nuevo.</B></big>';
exit();
}
echo'<p align=center><b><font size=4>Subida Satisfactoria<br>';

echo'<table border=1 width=84% height=52 bordercolorlight=#008080 bordercolordark=#008080>
<tr>
<td width=14% bgcolor=#008000 height=21><font color=#FFFFFF><b>Sn</b></font></td>
<td width=52% bgcolor=#008000 height=21><font color=#FFFFFF><b>Filename</b></font></td>
<td width=34% bgcolor=#008000 height=21><font color=#FFFFFF><b>Size</b></font></td>
</tr>';

for($i=1; $i<=UPLOAD_NO; $i++)
{

$just=filesize(${infile.$i});
$fp_size[i] = $just;
// Este es el Peso del Archivo echo$just;

if(${infile.$i}!=none &&
copy(${infile.$i}, $path .'/'.${infile.$i._name})
// move_uploaded_file ( $_FILES [ '${infile.$i}' ][ '${infile.$i._name} '], DESTINATION . '/' . $_FILES [ '${infile.$i}' ][ '${infile.$i._name}' ])
&& unlink(${infile.$i}))
{

echo'<tr>

<td width=14% height=19>'; echo$i; echo'</td>
<td width=52% height=19>'; echo${infile.$i._name}; echo'</td>
<td width=34% height=19>'; echo$fp_size[i]; echo'</td>
</tr>
';
}
}
echo '</table>';
}
?>





..................................SUBE ARCHIVO A CARPETA DESIGNADA..................



<?php

$path=$_SERVER['DOCUMENT_ROOT'].'/archivos/';

/* Destination of Upload files..use / insted of \\\\\\\\ in UNIX */
define($path,'cena2005');

/* Signamos a UPLOAD_NO la cantidad de infiles que queremos hacer */
define(UPLOAD_NO, 10);

if($REQUEST_METHOD!=POST)
{
print '<form enctype=multipart/form-data method=POST>';
print '<INPUT TYPE=hidden name=MAX_FILE_SIZE value=100000>';

for($i=1; $i<=UPLOAD_NO; $i++)
{
echo '<input type=file name=infile';echo$i;echo'>';

if($i%2==0)
print'<br>';
}
echo '<br><br><input type=submit value=Subir></form>';
}
else
{
/* handle uploads */
$noinput = true;
for($i=1; $noinput && ($i<=UPLOAD_NO); $i++)
{
if(${infile.$i}!=none) $noinput=false;
}
if($noinput)
{
print '<big><B>Error uploading. Intente de Nuevo.</B></big>';
exit();
}
echo'<p align=center><b><font size=4>Subida Satisfactoria<br>';

echo'<table border=1 width=84% height=52 bordercolorlight=#008080 bordercolordark=#008080>
<tr>
<td width=14% bgcolor=#008000 height=21><font color=#FFFFFF><b>Sn</b></font></td>
<td width=52% bgcolor=#008000 height=21><font color=#FFFFFF><b>Filename</b></font></td>
<td width=34% bgcolor=#008000 height=21><font color=#FFFFFF><b>Size</b></font></td>
</tr>';

for($i=1; $i<=UPLOAD_NO; $i++)
{

$just=filesize(${infile.$i});
$fp_size[i] = $just;
// Este es el Peso del Archivo echo$just;

if(${infile.$i}!=none &&
copy(${infile.$i}, $path .'/'.${infile.$i._name})
// move_uploaded_file ( $_FILES [ '${infile.$i}' ][ '${infile.$i._name} '], DESTINATION . '/' . $_FILES [ '${infile.$i}' ][ '${infile.$i._name}' ])
&& unlink(${infile.$i}))
{

echo'<tr>

<td width=14% height=19>'; echo$i; echo'</td>
<td width=52% height=19>'; echo${infile.$i._name}; echo'</td>
<td width=34% height=19>'; echo$fp_size[i]; echo'</td>
</tr>
';
}
}
echo '</table>';
}
?>


desde ya muchas gracias.

Salu2.