Using In-Memory Image Files

gotherthanthou

New member
Joined
May 16, 2009
Messages
1
Programming Experience
3-5
I am very new to both web development and VB .NET.

I have a page where a user can upload a JPG file. I store that image (along with identifying information) to a row in a SQL server database.

When I retrieve records from the database, how do I display those images? The Image toolbox object wants a URL and doesn't seem offer any alternative properties.

If there isn't a way to do this, how do I write the image to my hosting service's file system? All the file handling functions I can find seem to point to my local file system.

Forgive my total state of newbness.
 
Please post in the most appropriate forum for the topic of your question, not just the first one you come to. Moved.

Think about how web applications work. You build an aspx page using ASP.NET controls and they are then converted to the appropriate HTML code on the fly. How are images displayed in HTML pages? The page contains an <img> tag that contain the image location in an attribute. The browser then makes a request for the file at that location. There's no way that you can pass the image data itself to the web page because that's not how web pages work.

What you should be doing is not storing your images in the database at all, but rather storing them in the file system and then storing the location in the database. You can then get that location from the database and put it straight into your web page. The image file will then be loaded from that location.
 
If there isn't a way to do this, how do I write the image to my hosting service's file system? All the file handling functions I can find seem to point to my local file system.
If your app is located on your hosting service's machine then the local file system IS your hosting service's file system. The local file system is the file system of whatever machine the application is running on.
 
Back
Top