Limiting user for uploading maximum number of files in razor asp.net

DEKSHONONAMEN

New Member
I have a table photos, and i would like give user maximum 5 files to upload, how would i restrict user to upload file after 5 files and give message "maximum upload limit has reached" by checking number of files in database for that item ?\[code\]var ItemId = Request.Params["id"];var UserId = WebSecurity.CurrentUserId;var db = Database.Open("mystring");var insertCommand = "INSERT INTO Photos (ItemId,UserId,Thumb,Photo) VALUES(@0,@1,@2,@3)";db.Execute(insertCommand, ItemId, UserId, imageThumbPath, imagePath);\[/code\]
 
Back
Top