Problem retreiveing image from /images folder

Hi all, I have a simple search that would search for an image and print it out. Currently, my code is fine when the images are stored in the root folder.

But when I code the DB to store the images into ~/Images i can retrieve the result but not the image in my Dataset.

How do I make it so I can retrieve the images from the /Images folder 


2/14/2008 3:00:18 PM 91979 articles. 4 followers. Follow

4 Replies

Similar Articles

[PageSpeed] 48

It would help if you posted the code that is either saving or retrieving the images.

It may be as simple as using Page.ResolveUrl("~/Images/...") to get the correct virtual path, or Server.MapPath() to get the physical path.

Mark Doyle
Doyle ITS
2/14/2008 3:36:53 PM

after you retrived the image path from your DB and before assigning the image path, try using the method Server.MapPath("~/Images)

Please, mark as answer if this post helped you
"I am nobody
Nobody is perfect
Therefore, I must be perfect!"
2/14/2008 3:40:29 PM

Hmm I am actually using a Gridview

code as follows

    private string GetConnectionString()
        return "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("~/Images/FileUpload.mdb") + ";";

    private void BindData()
        OleDbConnection dbConn = new OleDbConnection(GetConnectionString());
        OleDbCommand cmdStr = new OleDbCommand("SELECT * from table", dbConn);

        OleDbDataAdapter adapt = new OleDbDataAdapter(cmdStr);       

        DataSet ds = new DataSet();
        adapt.Fill(ds, "tblFile");
        gridview1.DataSource = ds;

2/14/2008 5:08:39 PM


Based on my understanding, you want to display the image in the GridView control. If I have misunderstood you, please feel free to let me know.

I would like to suggest you use the below codes as your HTML code to show the image in the GridView:

        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
            DataKeyNames="CategoryID" >
                <asp:BoundField DataField="ID" HeaderText="ID" ReadOnly="True"
                    SortExpression="ID" />
                <asp:TemplateField HeaderText="image_url">
                        <asp:Image ID="Image1" runat="server" ImageUrl='<%# Eval("image_url") %>' /></a>
Hope it helps.

Vince Xu
Microsoft Online Community Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
2/18/2008 4:08:34 AM

Similar Artilces:

image in folder
Hi, Has anyone came across any code/tutorial for displaying an image in a folder as the folder itself.  I am looking to check a folder for images and if theres one there of the same name as the folder then to display the image as the folder...rather than the folder icon.  I am able to check the folder for the image names...but thought that someone must have surely pulled an image in a folder to be the folder image before. Thanks for any help... is this on a website? how are you displaying the folders? mcm   Hi, Its on a will be pointed...

I have problem to store images from a image folder to dataset
 My Code: DataSet DS = new DataSet();        DirectoryInfo objDI = new DirectoryInfo(Server.MapPath("~/Graduationpics"));        DataTable DT = new DataTable();        DT.TableName = "Images";                DataColumn DC = new DataColumn("img", Type.GetType("System.Byte[]"));        DT.Columns.Add(DC);     &nbs...

Problem making image
I have a Dell Latitude 131L that I am trying to make an image of, but it seems that imaging engine somehow cant find the partition with the OS, so I only get an image with 4k size. Anyone have any ideas to what might cause it, and posible solutions? On Fri, 27 Apr 2007 10:44:28 GMT, Thor wrote: > Anyone have any ideas to what might cause it, and posible solutions? it can't find the hd, which patchlevel are you running? -- If you have already compiled drivers or have linux.2 please put them on Live BootCd and... problem: i can not view image data for the rest of my table rows except the image for the first row but i can read all the other non image fields for all rows.
Hi i have a table with the following fields imgdata........image imgtitle.........varchar(max) imgType........varchar(max) imgLength.....bigint i have no problem with uploading the image but viewing the uploaded image(s) in a gridview has caused me great pain. The probelm is i have two pages. page1 grabs the image to display and page2 has a gridview that displays the grabed image. I wanted to have an sql statement like SELECT * FROM mytable WHERE incident_id=someValue. IF i have 5 records in this table and i view page2 ...

image and image
// create an image object, using the filename we just retrieved System.Drawing.Image image = System.Drawing.Image.FromFile(Server.MapPath(file)); // create the actual thumbnail imageSystem.Drawing.Image thumbnailImage = image.GetThumbnailImage(64, 64, new System.Drawing.Image.GetThumbnailImageAbort(ThumbnailCallback), IntPtr.Zero);   now my question is how to display this image in my image1 control in (version 1.1) the below line of code is not working.  Image1.ImageUrl=thumbnailImage.ToString();Mark As Answer If my reply helped you. Hi, you can save t...

Image in image
Hi, I have a project where clients viewing my website can buy t-shirts. They can choose from a number of t-shirt colors and shapes which are their plain colour. They can also choose a number of prints to be placed on the t-shirt. These will be graphics stored in a database. My problem is on how I can displaty the t-shirt with the graphics or logo they chose on te t-shirt. It would be something like drawing text on an image but instead drawing an existing image on the base image. Any Ideas? (I am using visual studio 2005 and vb.NET)   RegardsMerovingian you 1. You can create a...

Imaging, but not imaging
We multicasted to 43 machines. Updated the image on the master. Multicasted the updated image to 36 machines. (the other 7 wouldn't join the session for some unknown reason). I visually verified that all 36 were imaging. One of the 8 which didn't rename appears to not even have been imaged. The problems with the previous image were still there. It's as though the machine didn't image even though I saw it take part in the session and the temp bar going across the screen. What the heck's going on here? AlaN As a try, what happens if you boot either to PXE ...

Image on Image
I am trying to display a page that has image of a map on it. The user can then place other images of red thumbtacks on the image at different locations. Then when these thumb tacks are clicked on, they open a folder of pics related to the area. I saw a method in the imageButton class that returns the (x,y) of the location where the user clicked. I thought I could use this information to place another, smaller image button, on that area. My problem is that i can't seem to get the bottom imageButton to be transparent so I can see the smaller one. Am i on the right track with this. Any advi...

Save Images into the image folder
 Hi,I Have fileupload control. I amuploading files to the images folder of my Project.But i am unable to save the images into that folder because of i am not familiar about the path.I have to give path of that folder so that it can be application can work on any server.Currentyl I am using follwing Syntax.adimageFileUpload.SaveAs(("..\\images\\" + adimageFileUpload.FileName)) Can anybody solve this. Thank you.   hi try this Create images folder in your project folder. adimageFileUpload.SaveAs("~\images\" + adimageFileUpload.FileName) else adimag...

Delete images from the images folder ...?
 hi i have uploaded the images to my images folder in my projecti have been tried this codehere i am gettting th path name so using lastindexof and substring i will get the imagename only that is stored in fname1 , Let anyone have idea regarding this.... Dim fname As String = e.CommandArgument.Substring(e.CommandArgument.LastIndexOf("/"))Dim fname1 As String = (fname.Substring(1))' System.IO.File.Delete(Request.PhysicalApplicationPath + fname1)File.Delete(Server.MapPath("~/siteimage" & fname1))loadimage()message.Text = "Image Deleted...

Problems with a thumbnail image to popup Full-size image (image paths from a database)
I am hoping to get more feedback from entering this in perhaps a more appropriate forum.   Please refer to post   I think I’ve explained what I would like to do but can’t figure out how to successfully code it.   I found it interesting that if I removed the Onclick event, my Bind error goes away.   And changing the Bind to an Eval traded the Bind error for a parser error.   How can I pass the path of the Full size image from my DB to the javascript so that ASP and Java both are OK with the coding?  ...

Image upload wont save into the /images folder- only into main folder-
I have set up an input and i am trying to upload images, but even with my MapPath set to "../images" it still only saves the picture to the main folder and not into the images folder. Here is the code: public void Upload_Click(object sender, System.EventArgs e) { string strFileName = ImageUpload.PostedFile.FileName; strFileName = System.IO.Path.GetFileName(strFileName); ImageUpload.PostedFile.SaveAs(Server.MapPath("../images") + strFileName); Label3.Text = "Image Uploaded!"; Anybody have any ideas why? try adding...

display image in a image image button
hi   i have to display an image in image button while uploading mycode Image1.ImageUrl = Upload.PostedFile.FileName; is not working thanks Hi You need to save the PostedFile to the disk on the server and then assign it to ImageUrl. Take a look at the following links for more infoprmation on how to do this. Nassabehwww.professionalcsharp.comDon't forget to click "Mark as Answer" on the post that helped you. That way ...

JPEG image over Tranparent Image problem
Hi, I am just started my career as a developer few months back  and I am in my first project and I am struck. Please help. I am developing  a website with and C# In one of the web page, in an Image control, I have to display an image over an other image which I sucessfully did with various code articles help from the web. Now, in one scenario I have to place a smaller image first. Then over that I have to place a gif image(in which there is a circle transparent area). It is something like placing a photo in a photoframe. With some help from the web, I am able to d...

Web resources about - Problem retreiveing image from /images folder -

Resources last updated: 1/18/2016 3:31:59 PM