By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,952 Members | 1,617 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,952 IT Pros & Developers. It's quick & easy.

How can I upload images in my aspx page?

P: 54
Hi all,

I want to let user to upload images on my site and put some discription too!

I want that these things should be saved in my database too.SO how can I achieve this?
Mar 26 '12 #1
Share this Question
Share on Google+
8 Replies


Frinavale
Expert Mod 5K+
P: 9,731
Use the FileUpload control to allow the user to upload a file to the server.

Add a TextBox to the page so that they can enter a description.

Add a button so that the user can submit the page to the server. In that button click code, retrieve the file and either store it in database or in a file on the server...and store the description that the user entered into the database.
Mar 26 '12 #2

PsychoCoder
Expert Mod 100+
P: 465
First in my opinion it's bad practice to store images in the database. Going that route uses much more resources. If you are dead set on doing it that route then take a look at this blog post.
Mar 27 '12 #3

P: 54
@PsychoCoder
yeah i think you right, my one of friend also told me same, can you suggest me way for how to store it at some folder, and latter how can I retrieve it back when i want!
Mar 27 '12 #4

P: 54
dear on button click event what code behind I have to write that i exactly dont know so want help regarding that!
Mar 27 '12 #5

Frinavale
Expert Mod 5K+
P: 9,731
Upload the photo to a folder in the website (maybe call it Images so you know what it's for and it makes sense in a URL path).

Store the name of the photo in the database.

When you retrieve the data to display it later, concatenate the photo name retrieved from the database with the url path to the folder when the image resides...and display it in an Image control (or html <img>).

-Frinny
Mar 27 '12 #6

P: 54
CAn you please help me more??
I know this concept but getting hanged in programming!
Mar 27 '12 #7

PsychoCoder
Expert Mod 100+
P: 465
Did you look through the link I posted showing how to do what you're doing it?
Mar 27 '12 #8

Frinavale
Expert Mod 5K+
P: 9,731
What exactly are you stuck on?
The uploading part?
The displaying part?
The saving into the database part?

-Frinny
Mar 27 '12 #9

Post your reply

Sign in to post your reply or Sign up for a free account.