The page or script or whatever will be hosted on IIS and should basically accept a value from an hyperlink www.whatever.com?parametervalue=test and offer a file download with for example the name, myfile.file, containing the value ‘test’.
The parametervalue should have not characterlimit in the URL because it’s possible that the value that is passed is a very long string with 4000 characters or more.
I am not sure how to go about this. What technology can I use to get this done, html/javascript perhaps? I have tried Google’ing but cannot think of the right combination of words to pinpoint what I am looking for.
How can I get this done?
2
Answers
If I understood your question well you want to make link so when someone visits it download a file.
Then you can create download.php file and write there
Ok, so we have some web page. User clicks on some button. That button can then walk the dog, do payroll, and THEN we also want to take some xml file, and pass that to the next page, in which we offer a download button.
So, seems VERY little need to use or have or want or even consider using parameters in the URL here. Besides attempting to pass a xml string in a paramter would and could introduce all kinds of issues and probelms.
So, in first page:
Button click (why some hyper link???? makes zero sense here).
that button click as noted can do whatever we want, inclduing that of gettitng and obatining the xml file, and of couse we want to also provide and include a file name for the download.
so, on that 1st page, dump the use of a hyper link, and use a button.
That button will
Get the xml data we want, and save into sesison
Now, on the target page, we have that download button.
That download button can then do this:
So, from the page that jumps to your page with some information and the download button,, you can use code like above.
To pass the xml data, and the xml file name to be used, you can use session[] as per above.
Edit: Get the url paramter
As noted in comments, the xml data is to be passed in the URL, so now the above code becomes this:
Of course you replace "data" with whatever the name of the parameter value passed is.
Or, just grab the first value, say like this: