All Things WinBatch > WebBatch

Displaying local image in web file

<< < (2/3) > >>

td:
It is not clear that this is what you are trying to do but if you want to get a browser to download a file, you need to use the proper HTTP entity headers.  More specifically you need to WebOut a 'Content-type' header and a 'Content-disposition' to tell the browser the type of file and what you suggest the client do with it - like save it to the file system before calling WebOutFile.  You can use the "Content-type" header without the "Content-disposition" to instruct the browser to display the image without saving it to the client file system.  A quick Web search on those HTTP headers can provide the needed details.

Jeff:
If you look in my original post, I have a sample script. It looks like the web browser security is stopping it. 

td:
If you read the previous post carefully, you will notice that your "simple" script does not follow the recommendation to set the necessary and appropriate HTTP headers before attempting to output a file.   Your original script is not going to work as posted security or no security problem. 

Also, remember that a WebBatch script runs in the context of the WebServer.  If you are using IIS, this means the script is running with the security context of a restricted user account.   As such your script can only access system resource like file system locations that a restricted user can access.  IIS can impose additional restrictions on the IIS user based on IIS settings.

td:
A three liner that works with at least one browser:

--- Code: Winbatch ---WebOut("Content-type: image/bmp",1)
WebOut("Content-Disposition: inline", 2)
WebOutFile('e:\test\test.bmp')
 

Jeff:
First and foremost I am sorry to be a nuisance.

My overall goal is to build a knowledge base website to replace an existing phat client using the same SQL database. Inserting text strings have not been a problem, but handling images associated with the kb articles have been. In some way, I need to make images savable and viewable. And no, I am not a real developer but I have stayed at a holiday inn once or twice. 

After getting my test server <another physical web server>, I see what you are referring to as server side versus client side. I understand that the server runs the .web file using the webbatch executable server side and the client sees the rendered html. Not the actual web file.

Since moving some of my pages to different IIS server other than my local computer, when I save a file via the web browser it remains on my profile stored on the server. DefaultDownloadFolder=StrCat("C:\Users\",USERNAME,"\Documents")  and not on my local station. This is also why I can't open the file locally.

I know there has to be a way to upload and download files and render them locally. If you have any simple references or examples to point me to, I would appreciate it.

Thanks.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version