Ver Mensaje Individual
  #5 (permalink)  
Antiguo 29/11/2007, 17:30
flaktia227
 
Fecha de Ingreso: septiembre-2007
Mensajes: 17
Antigüedad: 16 años, 8 meses
Puntos: 0
Re: formulario upload

Hola a todos...

Estoy intentando subir archivos al servidor por medio de move_uploaded_file, todo funciona bien... pero el momento que hago un for($i=0... solo se suben dos archivos de los 3 ó 4, etc que intento subir...

Código:
function Archivo($n){
		$this->inp = $n;
		$this->nom = $this->inp['name'];
		$this->tip = $this->inp['type'];
		$this->tam = $this->inp['size'];
	}

function subir($dir,$n){
		$r;
		if ($n != ''){
			$r = move_uploaded_file($this->inp['tmp_name'], $dir.$n);
		}
		return $r;
	}
En otra clase tengo lo siguiente:

Código:
for($i=0;$i<$num;$i++)
	{
		$nom_fot[$i] = $HTTP_POST_FILES['txtFot'.$i];
		$j=$i+1;
		$nom_fot_2[$j] = $HTTP_POST_FILES['txtFot'.$j];
		$ft1 = new Archivo($nom_fot[$i]);
		$ft2 = new Archivo($nom_fot_2[$j]);
		
			$objFot = new Fotos();
			$fot = "tmp";
			$cod_fot = $objFot->insertFotos($fot,$fot,$cod_sem);
			if($cod_fot!=0)
			{
				$f1 = "fot".$cod_fot;
				$f2 = "fot".$cod_fot."_1";

//La primera vez funciona, pero cuando $i = 1, la función subir() me retorna false y no sube los archivos... si $i=0 sube exitosamente...

				if ($ft1->subir($path,$f1.'.jpg') and $ft2->subir($path,$f2.'.jpg'))
				{
					$nom_fot[$i] = $f1.'.jpg';
					$nom_fot_2[$j] = $f2.'.jpg';
					if($objFot->actualizarFotos($cod_fot,$nom_fot[$i],$nom_fot_2[$j]))
					{
						$ok="ok";
					}
				}
			}	
		
	}
Espero que me puedan ayudar ya que no me devuelve ningún error la función o no sé como puedo hacer para saber lo que está sucediendo... estoy dos semanas utilizando PHP...

Gracias...