asp.net file size

后端 未结 4 1187
一个人的身影
一个人的身影 2021-01-24 07:51

I want to get the file size before uploading to server. I used following code

Dim fileDetails As IO.FileInfo
fileDetails = My.Computer.FileSystem.GetFileInfo(fil         


        
4条回答
  •  遥遥无期
    2021-01-24 07:58

    Unfortunately you cannot check the file size on the client end. It shouldn't be that big of a deal, I have a few current production implementations allowing multiple file uploads that check the file size on server-side. It is not that long of a delay and I don't believe you will find a way around this.

    Something to make note of, the web.config has setting within that determines the maximum length (in kilobytes) of a single request. By default, this is set to 4MB. So if your user is trying to upload more than this amount, he will receive a server error. Here is how you change this:

    
      
    
    

提交回复
热议问题