upload image during registration in asp.net
I am developing a student registration form in asp.net. there are two tables viz std_registration and gallery(having pic_id and pic_url). During registration, before the click of submit button i want to retrieve pic_id from gallery table and then pass it to the insert query of registration table. image upload is an optional part. if no image is uploaded i want a default image to get uploaded.
pls help me on开发者_C百科 this. thanx.
Your algorithm:
- Add new user, get Id of user.
- The user is NOT optional and must be created. If not possible, the whole thing stops
- Look for the upload image, if not found return.
- Save the image, associating it to the user id.
Your tables should look like:
User
Id whatever PK
Name nvarchar(up to you)
YaddaYadda
ProfileImage
Id whatever PK
UserId whatever FK
Image Blob
The foreign key should NOT be in the User table. You aren't sharing images between users.
精彩评论