Click here to Skip to main content
16,020,186 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello everyone i am new in Dotnet i am working on a web application using asp.net and vb.net and i am trying to add the upload control in asp.net in order to upload all the diffrent files

I spend too many days looking in the net and i end up finding to many codes but no one of them had the answer that i am looking for .

Can plz someone helps me and explain to me how to control first the size of the files before storing it and then how to upload it in server and store the path in my database table .
Posted
Comments
Dave Kreskowiak 29-Jun-14 20:14pm    
Your question isn't answerable.

What do mean "control the size of the files before storing"??

What path? The path of the file on the client machine or on the server? If it's the client, that pretty useless information.

1 solution

To control file size and file name in server write below code in event while saving

VB
IF FileUploadControl.PostedFile.ContentLength  < 1024'<<your condition size should be in bytes>>
 Dim strserverpath as string
 Dim strfilename as string
 strserverpath = "" 'server path
 strfilename = Path.GetFileName(FileUploadControl.FileName)
 strfilename = strserverpath & strfilename
 FileUploadControl.SaveAs(strfilename)
 'save strfilename in database
END IF
 
Share this answer
 
v2
Comments
Member 10912919 30-Jun-14 7:16am    
thx for ur help i would like to know what are the modification that i should add in the web.config file

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900