Ver Mensaje Individual
  #1 (permalink)  
Antiguo 24/06/2010, 09:11
arceadalberto
 
Fecha de Ingreso: junio-2010
Mensajes: 16
Antigüedad: 13 años, 10 meses
Puntos: 0
Quiero Saber el Nombre de un archivo y su tamaño y guardar esos datos en mi BD

Hola y gracias por leer mi pregunta.

Bueno cree un formulario donde tengo 3 CAMPOS DE ARCHIVO (esos que tienen el boton EXAMINAR al lado derecho) bien uno es para subir una foto, pero los otros 2 son solo para buscar los archivos y saber su:
1. NOMBRE CON EXTENCION
2. SU TAMAÑO

Pero no guarda en la base de datos ni su nombre ni el tamaño porque son archivos de mas de 10 megas.

Lei que hay un limite de 2 megas, pero no quiero subir al servidor solo quiero saber nombre + extencion y su tamaño. Esque hay alguna solucion?

ESTE ES EL CODIGO PHP QUE VA ARRIVA DE LA MISMA PAGINA HTML

Código PHP:
<?php
include("conex.php");$status "";
if(isset(
$_POST['grabar'])){
    
    
$nombre=$_POST['nombre'];
    
$foto $_FILES["foto"]['name'];
    
$cvpc=$_FILES["cvpc"]['name'];
    
$cvpct=$_FILES["cvpc"]['size'];
    
$cvcel=$_FILES["cvcel"]['name'];
    
$prefijo substr(md5(uniqid(rand())),0,6);
    
$Nombre_foto=$prefijo."_".$foto;
    
$fecha=date("Y-m-d");
    
$hora=date('H:i:s');
    
    
    
$query="insert into cvs values('".$_POST['nombre']."','$Nombre_foto','$fecha','$hora','$cvpc','$cvpct','$cvcel')";
    
    
$rs=mysql_query($query$con);
    
    if(
$rs)
      {if (
$foto != "") {
           
$destino =  "../cvs/".$prefijo."_".$foto;
              if (
copy($_FILES['foto']['tmp_name'],$destino)){
                
$status "Archivo subido: <b>".$foto."</b>";
              } else {
$status "Error al subir Foto";              } 
          }
             
$status "Archivos enviados";
        }
    }
?>
ESTE ES EL FORMULARIO

Código HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Subir</title>
</head>
<body>
<form action="" method="post" enctype="multipart/form-data" name="fmodelo" id="fmodelo">
  <table width="386" border="0">
    <tr>
      <td width="160">Nombre</td>
      <td width="216"><input type="text" name="nombre" id="nombre" /></td>
    </tr>
    <tr>
      <td>Foto</td>
      <td><label for="foto"></label>
      <input type="file" name="foto" id="foto" /></td>
    </tr>
    <tr>
      <td>Cv Pc</td>
      <td><input type="file" name="cvpc" id="cvpc" /></td>
    </tr>
    <tr>
      <td>Cv titular</td>
      <td><input type="file" name="cvtitular" id="cvtitular" /></td>
    </tr>
    <tr>
      <td><?php echo"  ".$status; ?></td>
      <td><input type="submit" name="grabar" id="grabar" value="Grabar" /></td>
    </tr>
  </table>
</form>
</body>
</html> 

DE YA MUCHAS GRACIAS