atributo Size

18/05/2005 - 11:43 por sa | Informe spam
Hola,

necesito mostrar el tamaño de un fichero. para ello pongo:

response.write file.Size

pero sale el tamaño en bytes.

saben si se puede mostrar en MB.. por ejemplo: 0.09 MB

saludos y gracias,

Preguntas similare

Leer las respuestas

#1 Nuno Santos
18/05/2005 - 12:06 | Informe spam
Claro haces la conversión , es algo asin, espero no me tenga equivocado!!!
:-)
function getFileSizeTranslated (valor)
Dim temp
temp = valor
If Len(temp) <= 3 Then
getFileSizeTranslated = temp & " bytes"
ElseIf Len(temp) > 6 Then
temp = FormatNumber(((temp / 1024) / 1024), 2)
getFileSizeTranslated = temp & " megabytes"
Else
temp = FormatNumber((temp / 1024), 2)
getFileSizeTranslated = temp & " kilobytes"
End If
end function

Nuno Santos


Nuno Santos
nunos7[REMOVER]@hotmail.com

"sa" wrote in message
news:
Hola,

necesito mostrar el tamaño de un fichero. para ello pongo:

response.write file.Size

pero sale el tamaño en bytes.

saben si se puede mostrar en MB.. por ejemplo: 0.09 MB

saludos y gracias,
Respuesta Responder a este mensaje
#2 sa
18/05/2005 - 12:16 | Informe spam
gracias Nuno.. voy a probarlo

Nuno Santos escribió:
Claro haces la conversión , es algo asin, espero no me tenga equivocado!!!
:-)
function getFileSizeTranslated (valor)
Dim temp
temp = valor
If Len(temp) <= 3 Then
getFileSizeTranslated = temp & " bytes"
ElseIf Len(temp) > 6 Then
temp = FormatNumber(((temp / 1024) / 1024), 2)
getFileSizeTranslated = temp & " megabytes"
Else
temp = FormatNumber((temp / 1024), 2)
getFileSizeTranslated = temp & " kilobytes"
End If
end function

Nuno Santos

Respuesta Responder a este mensaje
#3 sa
18/05/2005 - 12:27 | Informe spam
Hola Nuno,

pongo esto en el asp:

<%= getFileSizeTranslated(file.Size)%>

y da este error:

Microsoft VBScript runtime error '800a01f4'

Variable is undefined: 'getFileSizeTranslated'




Nuno Santos escribió:
Claro haces la conversión , es algo asin, espero no me tenga equivocado!!!
:-)
function getFileSizeTranslated (valor)
Dim temp
temp = valor
If Len(temp) <= 3 Then
getFileSizeTranslated = temp & " bytes"
ElseIf Len(temp) > 6 Then
temp = FormatNumber(((temp / 1024) / 1024), 2)
getFileSizeTranslated = temp & " megabytes"
Else
temp = FormatNumber((temp / 1024), 2)
getFileSizeTranslated = temp & " kilobytes"
End If
end function

Nuno Santos

Respuesta Responder a este mensaje
#4 sa
18/05/2005 - 12:44 | Informe spam
Perdona Nuno, ya funciona, era error mio

Saludos y gracias,

Nuno Santos escribió:
Claro haces la conversión , es algo asin, espero no me tenga equivocado!!!
:-)
function getFileSizeTranslated (valor)
Dim temp
temp = valor
If Len(temp) <= 3 Then
getFileSizeTranslated = temp & " bytes"
ElseIf Len(temp) > 6 Then
temp = FormatNumber(((temp / 1024) / 1024), 2)
getFileSizeTranslated = temp & " megabytes"
Else
temp = FormatNumber((temp / 1024), 2)
getFileSizeTranslated = temp & " kilobytes"
End If
end function

Nuno Santos

Respuesta Responder a este mensaje
#5 Nuno Santos
18/05/2005 - 12:48 | Informe spam
Tienes que tener la función getFileSizeTranslated en el asp, el error indica
que no la consigue...

Nuno Santos


Nuno Santos
nunos7[REMOVER]@hotmail.com

"sa" wrote in message
news:%
Hola Nuno,

pongo esto en el asp:

<%= getFileSizeTranslated(file.Size)%>

y da este error:

Microsoft VBScript runtime error '800a01f4'

Variable is undefined: 'getFileSizeTranslated'




Nuno Santos escribió:
Claro haces la conversión , es algo asin, espero no me tenga
equivocado!!! :-)
function getFileSizeTranslated (valor)
Dim temp
temp = valor
If Len(temp) <= 3 Then
getFileSizeTranslated = temp & " bytes"
ElseIf Len(temp) > 6 Then
temp = FormatNumber(((temp / 1024) / 1024), 2)
getFileSizeTranslated = temp & " megabytes"
Else
temp = FormatNumber((temp / 1024), 2)
getFileSizeTranslated = temp & " kilobytes"
End If
end function

Nuno Santos

email Siga el debate Respuesta Responder a este mensaje
Ads by Google
Help Hacer una preguntaRespuesta Tengo una respuesta
Search Busqueda sugerida