Hi all,
Can u plz tell me as how to upload images.
I am developing an web application similar to picasaweb album.
I need to know as where the images to be saved(is it in database directly each image or just image path in database and files in application folder)

Can u plz provide me the database structure (if any ) similar to my application.

Expecting replyASAP

8 Years
Discussion Span
Last Post by kavita Tambe

don't used to save images in database. because it will load your database server. so you can use image storage path in database server to view the image in your ASP.net page.



From your post on C# forum i believe you want to know how to upload files in C#. I agree with tuhin.bd that you should store filepath of the image rather than the image itself.

Therefore to save a filepath of the selected image, you will first get the filepath of the image by the following code, which can be either behind a command button or however you want to invoke.

OpenFileDialog opfd = new OpenFileDialog();
opfd.Filter = "Your extension here (*.EXT)|*.ext|All Files (*.*)|*.*";
opfd.FilterIndex = 1;

if (opfd.ShowDialog() == DialogResult.OK)
    filepath = opfd.FileName;

This filepath can then be stored in your database which can be of text type in microsoft access for example.
Make sure that the directory path at your host matches the path saved.
Hope this helps, if you would like to know about retrieval of images from database in c#, please let me know.
I dont know much about asp so i hope somebody else posts saving and retrieving in asp

Edited by mike_2000_17: Fixed formatting

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.