วันศุกร์ที่ 25 กันยายน พ.ศ. 2558

หาขนาดไฟล์ด้วย FileInfo



Dim fileSize As String

fileSize = New IO.FileInfo(Server.MapPath("/download/files/form_bantuek (1).doc")).Length

If fileSize >= 1048576 Then
   fileSize = FormatNumber((fileSize / 1024) / 1024, 2) & "MB."
ElseIf fileSize > 0 Then
   fileSize = FormatNumber(fileSize / 1024, 2) & "KB."

End If


ไม่มีความคิดเห็น:

แสดงความคิดเห็น

การใช้ WebClient สำหรับเรียก URL

Dim _url As String = " https :// www . MyDomain . com /?q=ทดสอบ " Dim wc As New System . Net . WebClient () wc . Encodin...