NetTalk Central

Author Topic: Download link incorrect  (Read 2175 times)

Poul Jensen

  • Full Member
  • ***
  • Posts: 189
    • View Profile
    • Email
Download link incorrect
« 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

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11183
    • View Profile
Re: Download link incorrect
« Reply #1 on: August 15, 2014, 05:05:34 AM »
Hi Poul,

I think you best option is to post a small example so I can duplicate what you are seeing.

cheers
Bruce

Poul

  • Full Member
  • ***
  • Posts: 160
    • View Profile
Re: Download link incorrect
« Reply #2 on: August 15, 2014, 06:51:08 AM »
Code: [Select]
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

Code: [Select]
p_web.SSV('reporturl',CLIP(SUB(p_web.requestReferer, 1, INSTRING('IndexPage',p_web.requestReferer,1,1)-1)) & 'ExcelFiles/' & clip(g:ExelFilename))
?

Poul Jensen

  • Full Member
  • ***
  • Posts: 189
    • View Profile
    • Email
SOLVED Re: Download link incorrect
« Reply #3 on: August 17, 2014, 04:02:17 AM »
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