NetTalk Central

Author Topic: File download does not work  (Read 5823 times)

astahl

  • Sr. Member
  • ****
  • Posts: 308
    • View Profile
    • Email
File download does not work
« 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]
« Last Edit: July 31, 2015, 03:36:08 AM by astahl »

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11239
    • View Profile
Re: File download does not work
« Reply #1 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


astahl

  • Sr. Member
  • ****
  • Posts: 308
    • View Profile
    • Email
Re: File download does not work
« Reply #2 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

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11239
    • View Profile
Re: File download does not work
« Reply #3 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

astahl

  • Sr. Member
  • ****
  • Posts: 308
    • View Profile
    • Email
Re: File download does not work
« Reply #4 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

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11239
    • View Profile
Re: File download does not work
« Reply #5 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....

astahl

  • Sr. Member
  • ****
  • Posts: 308
    • View Profile
    • Email
Re: File download does not work
« Reply #6 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

astahl

  • Sr. Member
  • ****
  • Posts: 308
    • View Profile
    • Email
Re: File download does not work
« Reply #7 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


Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11239
    • View Profile
Re: File download does not work
« Reply #8 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

astahl

  • Sr. Member
  • ****
  • Posts: 308
    • View Profile
    • Email
Re: File download does not work
« Reply #9 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