Ver Mensaje Individual
  #1 (permalink)  
Antiguo 23/07/2007, 18:09
ric18
 
Fecha de Ingreso: marzo-2007
Mensajes: 49
Antigüedad: 18 años, 2 meses
Puntos: 0
¿Cómo puedo restringir extenciones en un upload?

Hola a todos, tengo el siguiente problema, tengo una aplicación en ASP donde subo un archivo al servidor y los datos a la BD, todo funciona, pero necesito restringir las extenciones a que sólo puedan subir archivos de excel con las extención .CVS. ¿como puedo hacerlo ya sea en JAVASCRIPT, que és como estoy validando los demás campos o con ASP? Mi variable que esta tomando el dato para saber que tipo de archivos está subien es

Código PHP:
 Dim contentType
      contentType 
load.getContentType("file"

Este és el código completo

Código PHP:
Response.Buffer True

   
' load object
   Dim load
      Set load = new Loader

      ' 
calling initialize method
      load
.initialize

   
' File binary data
   Dim fileData
      fileData = load.getFileData("file")      
   ' 
File name
   Dim fileName
      fileName 
LCase(load.getFileName("file"))
   
' File path
   Dim filePath
      filePath = load.getFilePath("file")
   ' 
File path complete
   Dim filePathComplete
      filePathComplete 
load.getFilePathComplete("file")
   
' File size
   Dim fileSize
      fileSize = load.getFileSize("file")
   ' 
File size translated
   Dim fileSizeTranslated
      fileSizeTranslated 
load.getFileSizeTranslated("file")
   
' Content Type
   Dim contentType
      contentType = load.getContentType("file")
     
          
   ' 
Noof Form elements
   Dim countElements
      countElements 
load.Count
   
' Value of text input field "name"
   Dim nameInput
     nameInput = load.getValue("name")
     
    '
response.Write(nameInput)
    
'response.End()
   ' 
Path where file will be uploaded
   
   
'Dim fso
       '    
Set fso Server.CreateObject("Scripting.FileSystemobjet")
   
   
   
Dim pathToFile
      pathToFile 
"D:\" & fileName
      
      'response.Write(pathToFile)
      'response.End()
      
   ' Uploading file data
   
   Dim fileUploaded
      fileUploaded = load.saveToFile ("
file", pathToFile)
      
    Dim usrname
    usrname = load.getValue("
nombre_usuario")
          
    Dim usrap
    usrap = load.getValue("
apellidos_usuario")
    
    Dim mail
    mail = load.getValue("
correo")
    
    Dim pais
    pais= load.getValue("
pais")
       
      'response.Write(fileUploaded)
      'response.End()
      

   ' destroying load object
   Set load = Nothing 
De antemano gracias.

Última edición por ric18; 23/07/2007 a las 19:59