NetTalk Central

NetTalk Web Server => Web Server - Ask For Help => Topic started by: astahl on July 31, 2015, 03:25:20 AM

Title: File download does not work
Post by: astahl on July 31, 2015, 03:25:20 AM
Hi Bruce,

File download gives Error 404 when the file actually does exist.

Your file download example is also broken. I included 3 doc files.

See attached.


Ashley

[attachment deleted by admin]
Title: Re: File download does not work
Post by: Bruce on July 31, 2015, 10:15:56 AM
Hi Ashley,

so to be clear, _uploading_ is working ok, but _downloading_ of ZIP files which are say in the uploads folder (and you know are fine) is not working?

I put a ZIP file in the web folder, and if I go to
127.0.0.1:88/happy.zip
then it downloads and opens ok. so it seems this isn't a problem with downloading a ZIP file in the
\web\folder.

in your example you have a NetWebPage called GenerateFile.
If I go to 127.0.0.1:88/generateFile
then I get a "Bad Request" error.  Is this what you are talking about?

If I look in that procedure, I see that you have it set as
Page Type: File
File name: loc:fileName

But looking in the procedure itself, loc:filename is not set to anything. So the error is understandable, downloading a "blank file" doesn't seem to make too much sense.

If I set loc:filename to doc1.doc, then I get a "Page cannot be found"  error. Is this the error you have in mind?

I had loc:filename = 'doc1.doc' and got the "page not found" error.

But that's because I wasn't specific as to the path. (if you don't add a path it assumes web folder).
So I changed it to
loc:filename = 'c:\temp\ashley\doc1.doc'

and the call to 127.0.0.1:88/generateFile
downloads the doc file and it opens in word ok.

so I guess you need to give me more specific information on what you are doing / seeing, and what you are hoping to get back...

cheers
Bruce

Title: Re: File download does not work
Post by: astahl on July 31, 2015, 03:02:58 PM
Hi Bruce,

Uploading is working fine.

No, what is being called ServeDocument. When you click on the files name link in the browse then you get the error. This has nothing to do with Generate file.

The files are already generated by another system and the information is put in a table that the ServeDocument proc would download called from a browse. The folder is the .\web\uploads folder. This was working since our website went live in November of last year. The ServeDocument proc has been broken since NT 8.57. the code that assigns to loc:filename is,

loc:filename = clip(p_web.site.apppath) & p_web.GetValue('name')

I think you are looking at the wrong proc, I should have been more explicit..


Ashley
Title: Re: File download does not work
Post by: Bruce on August 01, 2015, 12:43:12 AM
>> No, what is being called ServeDocument. When you click on the files name link in the browse then you get the error.

In the example you sent me you get that error because the file in the link (doc1.pdf) does not exist. If you add an entry for a file that does exist (doc1.doc) then it works.

I recommend you run DebugView - if the server encounters a link for which it doesn't find the file, then it writes the name of the file it could not find in debugview.  My guess is it simply isn't looking for the file you think it's looking for...

cheers
Bruce
Title: Re: File download does not work
Post by: astahl on August 01, 2015, 02:35:38 AM
Hi Bruce,

I believe I have it narrowed down to the SSL stuff again, my site is using HTTPS and not HTTP.

I know for sure that I have the file in the uploads folder and that the path is absolutely correct.

Ashley
Title: Re: File download does not work
Post by: Bruce on August 01, 2015, 02:55:10 AM
cool, all I need is an example, and instructions and I'm more than happy to take a look....
Title: Re: File download does not work
Post by: astahl on August 01, 2015, 03:00:38 AM
Hi Bruce,

The problem is that this a SQL system, and will take a little time to get an example into tps.

Ashley
Title: Re: File download does not work
Post by: astahl on August 01, 2015, 04:27:13 AM
Hi Bruce,

I was wrong about the SSL. But I did find the solution.

Ok this is really weird. I created a new NetWebPage procedure and copied the code from the old proc and pasted into the new proc.
Changed the link in the browse and compiled and ran. It now serves the document, how weird is that!

Ashley

Title: Re: File download does not work
Post by: Bruce on August 02, 2015, 10:13:06 PM
Would be nice to know what is different of course. But glad you got it working.

cheers
Bruce
Title: Re: File download does not work
Post by: astahl on August 03, 2015, 02:57:03 AM
Hi Bruce,

I was thinking the same thing. I have no clue what was going on with the old proc. But the new proc, code wise is exactly the same.

Ashley