Author Topic: Download a file irrespective of what is after the / in the URL  (Read 3079 times)

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.

Follow members gave a thank to your post:

reza

Offline sunnygps

  • Occasional poster
  • *
  • Posts: 5
    • View Profile
Re: Download a file irrespective of what is after the / in the URL
« Reply #1 on: March 21, 2013, 01:42:28 PM »
Anyone?

Follow members gave a thank to your post:

reza

Offline crazyboris

  • Tireless poster
  • ****
  • Posts: 140
    • View Profile
Re: Download a file irrespective of what is after the / in the URL
« Reply #2 on: March 24, 2013, 11:18:47 AM »
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
Re: Download a file irrespective of what is after the / in the URL
« Reply #3 on: March 24, 2013, 12:21:39 PM »
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: 12953
    • View Profile
Re: Download a file irrespective of what is after the / in the URL
« Reply #4 on: March 25, 2013, 09:01:06 AM »
I didn't understand if you want to discard the value of filename=...

Offline sunnygps

  • Occasional poster
  • *
  • Posts: 5
    • View Profile
Re: Download a file irrespective of what is after the / in the URL
« Reply #5 on: March 25, 2013, 03:07:21 PM »
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: 12953
    • View Profile
Re: Download a file irrespective of what is after the / in the URL
« Reply #6 on: March 31, 2013, 02:23:25 PM »
the command is {.?filename.}
like in
{.redirect|http://192.168.1.10:8081/my_folder/{.?filename.}.}

Offline sunnygps

  • Occasional poster
  • *
  • Posts: 5
    • View Profile
Re: Download a file irrespective of what is after the / in the URL
« Reply #7 on: April 01, 2013, 03:15:44 AM »
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: 12953
    • View Profile
Re: Download a file irrespective of what is after the / in the URL
« Reply #8 on: April 21, 2013, 06:42:14 PM »
conditions are made with the {.if.} command, but you didn't say what condition, neither you specified where you mean to store the value.