a litle example of my upload file

<form enctype="multipart/form-data" method="post" action="doupload.php" >
<p align="center">
<input name="userfile" type="file"  size=30 style="font-family: v;
font-size: 10pt; color: #5E6A7B; border: 1px solid #5E6A7B; padding-left:
4; padding-right: 4; padding-top: 1; padding-bottom: 1"><br>
<br>
<button type="submit" style="font-family: v; font-size: 10pt; color:
#5E6A7B; border: 1px solid #5E6A7B; padding-left: 4; padding-right: 4;
padding-top: 1; padding-bottom: 1">Transferir</button>
</p>
</form>


doupload.php

<?php
include "configimage.php";

$image_name= $HTTP_POST_FILES['userfile']['name']; //El nombre original del
fichero en la máquina cliente.

$image_type= $HTTP_POST_FILES['userfile']['type'];//El tipo mime del
fichero (si el navegador lo proporciona). Un ejemplo podría ser
"image/gif".

$image_size= $HTTP_POST_FILES['userfile']['size'];//El tamaño en bytes del
fichero recibido.

$image_tmp= $HTTP_POST_FILES['userfile']['tmp_name']; //El nombre del
archivo temporal

$mime_type=array("image/jpeg",
                 "image/pjpeg",
                 "image/gif",
                 "image/x-png" );

$ext = strrchr($image_name,'.');

      $endresult = "<font size=\"2\">El archivo ha sido transferido <br><a
target=_blank href=http://bmwfaq.com/uploads/$image_name>
http://www.bmwfaq.com/uploads/$image_name </a></font>";

      if ($image_name == "") {
            $endresult = "<font size=\"2\">No se han seleccionado
archivos</font>";

      }elseif (($size_limit == "yes") && ($limit_size < $image_size)){
            $endresult = "<font size=\"2\">El archivo es demasiado
grande</font>";

      }elseif (($limit_ext == "yes") && (!in_array(strtolower
($ext),$extensions))) {
            $endresult = "<font size=\"2\">Este tipo de archivo no está
permitido</font>";

      } elseif (!in_array($image_type, $mime_type)) {
            $endresult = "<font size=\"2\">Este tipo de archivo no es una
imágen</font>";

      } elseif (file_exists("$absolute_path/$image_name")) {
                  $endresult = "<font size=\"2\">El archivo ya existe en el
servidor</font>";
      } else {
            if (is_uploaded_file($image_tmp)){
                  copy ($image_tmp,$absolute_path."/".$image_name);
            }else{
                  "Possible file upload attack. Filename: " .
$HTTP_POST_FILES['userfile']['name'];
            }

      }
?>




                                                                                       
                                                
                      "Peda"                                                           
                                                
                      <[EMAIL PROTECTED]>      Para:     [EMAIL PROTECTED]             
                                        
                                               cc:                                     
                                                
                      25/07/2003 13:51         Asunto:   Re: [PHP] File upload         
                                                
                                                                                       
                                                
                                                                                       
                                                





>
> maybe you should try $HTTP_POST_FILES?
>
I have tryed that too, but nothing happened.



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php







--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to