PHP - Error php

 
Vista:

Error php

Publicado por Vicent (8 intervenciones) el 16/09/2006 11:32:03
Hola,
Tengo el siguiente fragmento de código en php:

Linea 9://Comprobamos el tipo de archivo
Linea 10: $tipo = split("/",$archivo_type);
Linea 11: echo "Tipo de archivo es: "; echo $tipo[1];
Linea 12:if (($tipo[1] != "msword") and ($tipo[1] != "pdf"))

Mi problema esta en que cuando lo ejecuto en local no me da ningún tipo de error, pero cuando lo subo al servidor me da el siguiente error:
Notice: Undefined offset: 1 in D:\ruta_directorio\enviar.php on line 11
Notice: Undefined offset: 1 in D:\ruta_directorio\enviar.php on line 12
Notice: Undefined offset: 1 in D:\ruta_directorio\enviar.php on line 12
Como puedo solucionarlo, muchas gracias!!
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:Error php

Publicado por Mike79 (669 intervenciones) el 17/09/2006 08:10:06
No pues esta raro
intenta imprimir antes la variable $archivo_type
y luego intenta imprimir
$tipo[0]
echo $archivo_type."\n";
echo $tipo[0]."\n";
echo $tipo[1]."\n";

obviamente no existe el indice 1 por eso te marca un error. Pero la razon por la cual no hay indice 1 no lo se.
Talvez no te esta regreando la cadena mime bien, o no hay diagonales /

Buscale bien y si tienes duda, pregunta de nuevo.

Saludos!
-
Miguel Angel
Mike79
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

solo un vector aprendiendo error undefined offset

Publicado por andres (7 intervenciones) el 23/11/2009 11:54:09
APENAS ESTOY APRENDIENDO PHP PERO ME SALE ESTE ERROR ES SOLO LLENAR UN VECTOR Y MOSTRARLO

Notice: Undefined offset: 1 in C:\Archivos de programa\EasyPHP5.3.0\www\vector.php on line 47

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>

<body>

<?php
class Vector{
private $vec=array();
public $tamano;
public $h=0;

public function __construct($tam)
{
//tamaño del vector
$this->vec[] =$tam;

}

public function llenar($dat)

{ //inicializo vector en 0

$dato=$dat;
$this->vec[$this->h]=$dato;
$this->incrementar();

}

public function incrementar()
{

$this->h=$this->h++;

}
public function imprimir()

{

echo '<td>'.$this->vec[1].'</td>';
echo '<br>';
}
}

$vector1=new Vector('5');
$vector1->llenar('8');
$vector1->llenar('1');
$vector1->llenar('3');
$vector1->llenar('7');
$vector1->imprimir();
?>

</body>

</html>
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar