NetTalk Central

NetTalk Web Server => Web Server - Ask For Help => Topic started by: broche on March 23, 2014, 01:55:00 PM

Title: Download Filename appends directory
Post by: broche on March 23, 2014, 01:55:00 PM
Hi all, 
Nettalk 8, Clarion 8, Win 7
Firefox
Downloading file successfully except the name of the file when it hits the browser on the client side puts the directory I got it from on ths start of the filename.
Example:  File name is brian.doc
When the file is downloaded it becomes c_templateBrian.doc
C:\Template is where I got it from on the server.  See code below:

loc:filename = p_web.GSV('TemplateDir') & '\' & p_web.GetValue('name')
p_web.HeaderDetails.ContentDisposition = 'attachment; filename="'&loc:filename &'"'

Not sure what I am doing wrong?

Brian.





Title: Re: Download Filename appends directory
Post by: Bruce on March 23, 2014, 10:18:23 PM
Hi Brian,

I suppose the question becomes;

what are the contents of p_web.GSV('TemplateDir') and p_web.GetValue('name')
and hence what is in loc:filename after

loc:filename = p_web.GSV('TemplateDir') & '\' & p_web.GetValue('name')

Cheers
Bruce
Title: Re: Download Filename appends directory
Post by: broche on March 24, 2014, 09:00:14 AM
Thanks Bruce,

TemplateDir is the location the blob is extracted to on the server
name is the exact name of the file eg brian.doc being passed by the servedocument routine when the doc is clicked for download.
So I see that that is what it is being named I suppose I don't understand how the code is getting the file?

I thought loc:filename had to contain the full path in order for that line to knoiw where the file is being pulled from?

Brian
Title: Re: Download Filename appends directory
Post by: Bruce on March 24, 2014, 12:18:25 PM
No, it's the opposite. Content disposition suggests a save-as name to the browser. Don't include a path there.
Title: Re: Download Filename appends directory
Post by: broche on March 24, 2014, 04:09:29 PM
Thanks that worked - Sorry but I still don't understand how it is getting the file I want.
The file is in C:\Templates
Not in the web directory, so how does it know this?
from:
 loc:filename = p_web.GSV('TemplateDir') & '\' & p_web.GetValue('name')
 loc:brname = p_web.GetValue('name')
 p_web.HeaderDetails.ContentDisposition = 'attachment; filename="'&loc:brname &'"'

Thanks