Ver Mensaje Individual
  #4 (permalink)  
Antiguo 23/02/2002, 23:01
KRYZTO
 
Fecha de Ingreso: enero-2002
Mensajes: 314
Antigüedad: 22 años, 3 meses
Puntos: 0
Re: FORMULARIO: ¿Qué poner para enviar una foto?

<pre> &lt;?php
header(&quot;Expires: 0&quot;);
header(&quot;Pragma: no-cache&quot;);
$path = &quot;/ruta/hacia/mi/directorio/tmp&quot;;
$url = &quot;http://www.tupagina.com/tmp&quot;;
$tam = 50;
implementación de
function in_array($needle, $haystack) {
for($i=0;$i&lt;count($haystack)&amp;&amp;$haystack[$i]!=$needle;$i++);
return ($i!=count($haystack));
}
*/


if(isset($send)) {
$dir = opendir($path);
while($arch = readdir($dir))
$directorio[count($directorio)] = $arch;
closedir($dir);
$mensaje = &quot;&lt;font face=\&quot;Verdana, Arial\&quot; size=2&gt;\n&quot;;
if($archivo == &quot;none&quot;) {
$mensaje .= &quot;No ha seleccionado ningún archivo para agregar a la lista. &quot;;
$mensaje .= &quot;Por favor inténtelo de nuevo.&quot;;
}
elseif(in_array($archivo_name,$directorio)) {
$mensaje .= &quot;Ya existe un archivo con el nombre &lt;b&gt;$archivo_name&lt;/b&gt;&quot;;
$mensaje .= &quot;Por favor inténtelo de nuevo.&quot;;
}
else {
$fichero = $path . &quot;/&quot; . $archivo_name;
copy($archivo, $fichero);
$kb = filesize($fichero) / 1024;
if($kb &gt; $tam) {
unlink($fichero);
$mensaje .= &quot;No puede ser agregado ya que ha pasado el tamaño permitido. &quot;;
$mensaje .=
&quot;Actualmente sólo permitimos archivos de hasta $tam kb.&quot;;
}
else {
$mensaje .= &quot;Su archivo ha sido agregado exitosamente. &quot;;
$mensaje .= &quot;Muchas gracias por su contribución.&quot;;
}
}
$mensaje .= &quot;&lt;/font&gt;&lt;br&gt;&lt;hr&gt;&lt;br&gt;\n&quot;;
}
$dir = opendir($path);
while($arch = readdir($dir)) {
if($arch != '.' &amp;&amp; $arch != '..') </pre>