Maybe the title isn't completely correct, but I don't know the correct terminology for this.
Situation: My hosting has these folders accessible via FTP:
- data
- www (read-only)
As you can see, I have to put all databases, textfiles that need to be written to, uploaded files, ... in the data folder, because www is read-only.
However, the website goes straight to www (the physical path).
For databases and textfiles there is no problem, I can just use APPL_PHYSICAL_PATH.
SoRequest.ServerVariables("APPL_PHYSICAL_PATH") & "..\data\Database.mdb" takes me to the Database.mdb file in the data folder.
However, images in the data folder are more of a problem, since the client requests them, not the server. So when I use <img src="http://pics.10026.com/?src=http://... I inevitably arrive in the www folder.
Is there a solution so I can let the server return an image located in the data folder? I need that for an image gallery of uploaded images. I can't let a script copy them to the www folder because www is read-only and there is no way I can change any permissions.
I want to avoid solutions like<img src="http://pics.10026.com/?src=image.asp?name=IMG0001.JPG"> because I don't every image being called image.asp when someone saves them to their computer. Or is there a way to avoid that? Maybe there is a way to have anIMG0001.JPG in the www folder that is in fact a server sided script that returns the respective image from the data folder? Or a way to let the server know any request in a certain folder needs to be redirected on the server (For example: a script in the redirect folder that returns any request like http://.../redirect/IMG0001.JPG from the data folder). The last two solutions would give the correct filename when trying to save them to HD.
Thanks for your time.
Hi,
I think there is no problem for retrieving data from database. so you can store the images in your database and retrieve it back with the Handler. Anyhow you cannot control the image name either you have to save the image name as it is, but atleast you can set the image file type if you use the handler.
Please check this article below to store and retrieve image data from database.http://www.aspdotnetcodes.com/Insert_Images_Database.aspx
thanks
How about implementing a HttpHandler that intercepts all requests for files with imagetype-extensions and
delivers the data from the data-directory.
Ie. the webpage refers to <img src="http://pics.10026.com/?src=http://server/image.jpg"> but there actuall a HttpHandler that kicks in and
serves the image.
Here's a sample article:
http://www.devx.com/dotnet/Article/6962/0/page/3
Otherwise search for HttpHandler on the net.
Regards
Fredr!k
0 comments:
Post a Comment