NetTalk Central
NetTalk Web Server => Web Server - Ask For Help => Topic started by: Poul Jensen on August 15, 2014, 12:24:04 AM
-
Hi,
In a NetwebForm I create a link, calls a procedure that generates an Excel fil and shows a link to the user to download the file.
Below code is grabbed from one of the demo's (can't remember which one).
The Excel file is correctly created and placed in the ExcelFiles folder but the downloadlink is not working.
Between the webpage and the folder/filename is inserted the procedurename and a number of spaces like this:
http://webpage:88/ProcedureName%20%20%20%20%20%20%20%20ExcelFiles/97142171_varepriser.xls
What could be wrong in my code:
g:ExelFilename = clip(p_web.GSV('Kundenummer')) & '_varepriser.xls'
reportpage='\web\ExcelFiles\' & clip(g:ExelFilename)
reporturl=LongPath() & reportpage
p_web.SSV('reportlink','Click to open new Excel file.')
p_web.SSV('reporturl',CLIP(SUB(p_web.requestReferer, 1, INSTRING('IndexPage',p_web.requestReferer,1,1)-1) & 'ExcelFiles/' & clip(g:ExelFilename)))
if Exists(reporturl)
Remove(reporturl)
end
CreateExcelFile(p_Web, g:ExelFilename )
The ViewReport procedure that shows the link has this routine:
Guts Routine
packet.append(p_web.AsciiToUTF(|
'<<!-- Net:PageHeaderTag--><13,10>'&|
'<<h2 fontcolor="Navy">Done: Excel file created!<</h2><<p /> <<a href="<<!-- Net:s:reporturl-->"><<!-- Net:s:reportlink--><</a> <<p /><13,10>'&|
'<<a href="javascript:history.go(-1)">Back<</a><13,10>'&|
'<<!-- Net:PageFooterTag--><13,10>'&|
'',net:OnlyIfUTF,net:StoreAsAscii))
Cheers,
/Poul
-
Hi Poul,
I think you best option is to post a small example so I can duplicate what you are seeing.
cheers
Bruce
-
p_web.SSV('reporturl',CLIP(SUB(p_web.requestReferer, 1, INSTRING('IndexPage',p_web.requestReferer,1,1)-1) & 'ExcelFiles/' & clip(g:ExelFilename)))
should it be
p_web.SSV('reporturl',CLIP(SUB(p_web.requestReferer, 1, INSTRING('IndexPage',p_web.requestReferer,1,1)-1)) & 'ExcelFiles/' & clip(g:ExelFilename))
?
-
My bad: I had the wrong procedurename in the code instead of "IndexPage"
This:
p_web.SSV('reporturl',CLIP(SUB(p_web.requestReferer, 1, INSTRING('IndexPage',p_web.requestReferer,1,1)-1) & 'ExcelFiles/' & clip(g:ExelFilename)))
Should be:
p_web.SSV('reporturl',CLIP(SUB(p_web.requestReferer, 1, INSTRING('MyProcedureName',p_web.requestReferer,1,1)-1) & 'ExcelFiles/' & clip(g:ExelFilename)))
Cheers,
/Poul