Foros del Web » Programando para Internet » ASP Clásico »

Tamaño en bytes de un archivo alojado en el servidor

Estas en el tema de Tamaño en bytes de un archivo alojado en el servidor en el foro de ASP Clásico en Foros del Web. ¿Alguien me puede decir como puedo conocer el Tamaño en bytes de un archivo alojado en el servidor, con asp? Un saludo...
  #1 (permalink)  
Antiguo 21/09/2004, 09:02
 
Fecha de Ingreso: marzo-2003
Mensajes: 83
Antigüedad: 21 años, 2 meses
Puntos: 0
Tamaño en bytes de un archivo alojado en el servidor

¿Alguien me puede decir como puedo conocer el Tamaño en bytes de un archivo alojado en el servidor, con asp?

Un saludo
  #2 (permalink)  
Antiguo 21/09/2004, 09:04
Avatar de Saruman  
Fecha de Ingreso: mayo-2003
Ubicación: Panama city, Panama, Panama
Mensajes: 1.154
Antigüedad: 21 años
Puntos: 5
chequea esta funcion que tengo:

Código:
Function FileSize(Path, FileName, Tipo)
		set FSO = Server.CreateObject("Scripting.FileSystemObject")
		set oFile = FSO.GetFile(Server.MapPath(Path & FileName))
	
		FileSize = oFile.Size
		
		select case Tipo
			case 2:
				FileSize = Round(FileSize / 1024, 2)
			case 3:
				FileSize = Round(FileSize / 1048576, 2)
			case 4:
				FileSize = FileSize & " bytes"
			case 5:
				FileSize = Round(FileSize / 1024, 2) & " KB"
			case 6:
				FileSize = Round(FileSize / 1048576, 2) & " MB"
			case 7:
				if FileSize > 0 and FileSize < 1024 then
					FileSize = FileSize & " bytes"
				elseif FileSize >= 1024 and FileSize < 1048576 then
					FileSize = Round(FileSize / 1024, 2) & " KB"
				elseif FileSize >= 1048576 then
					FileSize = Round(FileSize / 1048576, 2) & " MB"
				end if
			case else
				FileSize = FileSize
		end select
		
		set oFile = nothing
		set FSO = nothing
End Function
__________________
Saruman

One Ring to rule them all, One Ring to find them, One Ring to bring them all and in the darkness bind them.
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 02:17.