The [File_Serve] method serves a file which is stored in a variable in place of the current Lasso response. The name of the file can be specified and, in supported browsers, the file will be written to disk using that name and/or displayed in the browser.
The [File_Serve] method can be used to serve image files, multimedia files, file archives, or even HTML files.
None of the contents of the current response will be served. [File_Serve] completely rewrites the HTTP headers and contents of the served response. [File_Serve] also performs an [Abort] so no code after [File_Serve] will be executed.
The first parameter to the method should be a variable which contains the file to be served. An optional -File parameter allows the name of the file to be specified. An optional -Type parameter allows the MIME type of the served file (default 'text/html') to be overridden.
Possible MIME types include:
file_serve( content_bytes, -file, -type='type', -charset='charset', -disposition='attachment' ) File_Serve('File Data') File_Serve('File Data', -File='Example.html') File_Serve('Image Data', -File='Example.gif', -Type='image/gif') local(myFile = Include_Raw('Example.jpg')) File_Serve(#myFile, -File='Example.jpg', -Type='image/jpeg')
No examples found
Please note that periodically LassoSoft will go through the notes and may incorporate information from them into the documentation. Any submission here gives LassoSoft a non-exclusive license and will be made available in various formats to the Lasso community.