rejetto forum

Download a file irrespective of what is after the / in the URL

0 Members and 1 Guest are viewing this topic.

Offline sunnygps

  • Occasional poster
  • *
    • Posts: 5
    • View Profile
I have a requirement where we can have a number of users connect to the server and download a specific file. The request will be to a static IP address like http://192.168.1.10:8081/ but could also be like http://192.168.1.10:8081/?filename=xxx&version=33.xx.

My requirement at this time is to ignore what is after 8081/ and server them the file that is off the root folder.

I have tried the below 2 in Diff template, but it seems to not work. I see the "Requested GET" in the log windows, but the file specified never get download.

{.redirect|http://192.168.1.10:8081/d_custom.bin.}

[+not found]
{.add header|location: http://192.168.1.10:8081/d_custom.bin.}

Anyone can help me with the script? Eventuly, I would like to be able to parse the URL and server the appropriate file to request.

Thank you.



Offline crazyboris

  • Tireless poster
  • ****
    • Posts: 140
    • View Profile
havent tryed this but what if you :
 rightclick on root
then properts
then diff template
add the "download code" there.


Offline sunnygps

  • Occasional poster
  • *
    • Posts: 5
    • View Profile
I have already tried that and it did not work. What is working though, is the if I just one file off the "/" root, then then that file gets transfered irrespective of what the URL is.

I still need to figure out how to parse the URL and redirect to the appropriate file.

Thanks!


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13510
    • View Profile

Offline sunnygps

  • Occasional poster
  • *
    • Posts: 5
    • View Profile
I didn't understand if you want to discard the value of filename=...

The ultimate goal is to read the URL and based on the what is in the "filename" and "ver" redirect to the appropriate link (file) to be downloaded.

The first test I was doing was to just redirect to a link irrespective of what was after the ":8080/" in the URL. This way, all the "not found" and other errors messages could be ignored to amke sure what I was using the HFS for could be accomplished. Which it did.

Now I am on to figuring out how to read the URL and redirect based on what variable are being passed on.

Thanks!


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13510
    • View Profile
the command is {.?filename.}
like in
{.redirect|http://192.168.1.10:8081/my_folder/{.?filename.}.}


Offline sunnygps

  • Occasional poster
  • *
    • Posts: 5
    • View Profile
Thank you. One last question. How do I create a condition statement to store the value of the urlvar and then redirect to the appropriate file for download?

Thank you once again for your help.


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13510
    • View Profile
conditions are made with the {.if.} command, but you didn't say what condition, neither you specified where you mean to store the value.