Im is working on a web application, and one of the functions that they need is the ability to download a fairly large file interactively - this file does not exist on the server and consists solely of data dynamically loaded from the database.
I am currently using the following code (don't run for you, but you can get this idea) in which I add a text box with the file name, then a hidden text area containing all the text needed to load the json style, and then linked to the function which is trying to load the URI.
Dependently, when you run in chrome, I get a page in which the URI is too long and it will not work, etc., but the file still loads.
"The URI presented is too long! The requested URL is longer than the capacity limit for this server. The request could not be processed. If you think this is a server error, contact the webmaster.
In any case, this is annoying: The page allowing these downloads uses the message / receive from the previous page - therefore, the "Back" button is not available because it gives us:
"Confirmation of re-application This web page requires the data that you entered earlier for the correct display. You can send this data again, but you will repeat any action that this page previously performed.
page - I would really like these URI downloads to appear on a new tab, so the back button is not needed, although adding an empty address did not help
Also intereseting - as you can see above, I have a function for "download everything" that works for me, performing actions locally on the xampp server, on google chrome - however, those who create the application report that the button does not work for them (they are on macs using safari, havent had the opportunity to see it for yourself and collect information yet - therefore, although I am not EXPECTING the answer to this with my limited information, I hope someone can have an idea!)
CODE:
< script > function download(filename, text) { var element = document.createElement('a'); element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent(text));
echo " <form onsubmit=\ "download(this['name'].value, this['text'].value)\" class=\ "form-group\">"; echo "<label for=\ "name\">Download Title</label>"; echo "<input type=\ "text\" name=\ "name\" size=\ "40\" value=\ "" . $m[ 'name'] . ".json" . "\" class=\ "form-inline\">"; //hidden=\"hidden\"> after text echo "<textarea name=\ "text\" hidden=\ "hidden\">" . $json_meal_data . "</textarea>"; echo "<input type=\ "submit\" value=\ "Download\" class=\ "btn-primary\">"; echo "</form>"; echo "<br>"; echo "<br>";
It is also definitely worth noting that I have included the “Download All” function in the above snippets. It's strange that launching everything downloaded in Chrome downloads all the files, but running it in Safari only downloads 1 file.