proseox
#1
I get informations from a textarea, but i cant save the file.
textarea = encode
filename without extension is a textfield
and my save button
this is my php code
$filename= exo_return_hescriptcom("UserMain.SaveDlgFile", "Error");
$encoded->Output($encoded, "F");
encoded is my text in textarea which i get with POST
it opens the save file dialog but the script is not saving anything
Your code looks strange. Shouldn’t it be:
$filename= exo_return_hescriptcom(“UserMain.SaveDlgFile”, “Error”);
$encoded->Output($filename, “F”);
proseox
#3
I’ve tested all… now i have this code and i can save a file, but the file is empty
$string = 'xxxxxxxxx';
header ('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header ('Content-Type: application/octet-stream');
header ('Content-Length: ' . strlen($string));
header ("Content-Disposition: attachment; filename=\"$filename\"");
$filename = exo_return_hescriptcom("UserMain.ExportMyFile", "Error");
$string->Output($filename, "F");
This way won’t work.
These instructions especially:
header ('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header ('Content-Type: application/octet-stream');
header ('Content-Length: ' . strlen($string));
header ("Content-Disposition: attachment; filename=\"$filename\"");
Remove the code above and use:
$filename = exo_return_hescriptcom("UserMain.ExportMyFile", "Error");
$string->Output($filename, "F");
You can also check that $filename is a correct full path return by the HEScript function.
For instance, just add
echo $filename;
proseox
#5
Thanks alot. This works now for me:
$data = $encoded ;
$filename = exo_return_hescriptcom("UserMain.ExportMyFile", "Error");
include ("export.php");
echo $success;
$fp = fopen($filename,'wb');
if(!$fp)
echo 'Unable to create output file: '.$filename;
fwrite($fp, $data);
fclose($fp);
exit;