Download file from a cgi running on Linux

Hello,

I have some files (images, excels, pdfs …) on my Linux server. I would like to allow users to download these files in my web app application. Here is my code:

if DataList.ListIndex >= 0 then
dim ImagePath as string

#if TargetWindows then
ImagePath = “c:\temp” + “Images\Stock” + str(session.AccountID) + “” + mid(format(StockID, “00000000”), 1, 4) + “” + format(StockID, “00000000”) + “”
#else
ImagePath = app.ImageRootPath + “Images/Stock/” + str(session.AccountID) + “/” + mid(format(StockID, “00000000”), 1, 4) + “/” + format(StockID, “00000000”) + “/”
#endif

var f as FolderItem = new FolderItem(ImagePath + DataList.cell(DataList.ListIndex, 0), FolderItem.PathTypeURL)

if f <> nil and f.exists then
dim file as WebFile = WebFile.Open(f)
file.ForceDownload = true

ShowURL(file.url)

end if
end if

But seems this does not work, can someone help? Thanks.

P.S. I would prefer the download process performs like download files my many websites that the file appears in the lower left hand corner of the browser (save in browser’s default path) which does not affect the user using the app.

If the files are in the web space, simply use links.

if they are in another place not accessible on the web, check out the example at Example Projects/Web/Downloading.

I use that to deliver software.

Thanks Michel,

session.ShowUrl(myURL, True)

solves my problem.