I have a string that represents an 812 bit file as a hex string. I'm trying to pass this in some way to a php script that will force a download of the file. The problem is that the URL string is too long. The length of just the hex string is 1624. Is there some sort of encoding or encryption I can use to shorten the string and still be able to get the expected result on the php side? I have tried sending json with an Ajax request, but I don't believe I can force a download that way.
JS:
var cfg = '';
for (var x = 0; x < relayBytes.length; x++)
{
var str = relayBytes[x].toString(16);
if (str.length === 1) str = '0' + str;
cfg += str;
}
window.location = '../script.php?relay=' + cfg;
relayBytes is an int array with a length of 812.
PHP:
<?php
header('Content-Type: application/octetstream; name="file.txt"');
header('Content-Type: application/octet-stream; name="file.txt"');
header('Content-Disposition: attachment; filename="file.txt"');
echo $_GET['relay'];
?>