Question

I want to browse to folder on button click and select a file in that folder. When user selects a particular file. I want to retrieve the folder path and size of that file ?

How can i do that in asp.net with c#

BTW i'm using vs2008.

Please help me

Thanks in anticipation

Was it helpful?

Solution

Why not use the FileUpload control instead of a Button? http://asp.net-tutorials.com/controls/file-upload-control/

Using FileUpload control, it will accept file uploads from users and is extremely easy. With the FileUpload control, it can be done with a small amount of lines of code, as you will see in the following example. However, please notice that there are security concerns to to consider when accepting files from users!

OTHER TIPS

Use the FileUpload control to let user browse to the file, select it and upload it. Unfortunately, there is no way to retrieve the file size until the file is uploaded (without using Silverlight or other third-party browser components). Once the file is uploaded, you can retrieve file size via the ContentLength property.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top