Problem saving file (SOLVED)

proseox

New member
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
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
 
Last edited:
Your code looks strange. Shouldn’t it be:

$filename= exo_return_hescriptcom(“UserMain.SaveDlgFile”, “Error”);

$encoded->Output($filename, “F”);
 
Last edited:
I’ve tested all… now i have this code and i can save a file, but the file is empty
Code:
$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");
 
Last edited:
This way won’t work.
These instructions especially:
Code:
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:
Code:
$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;
 
Last edited:
Thanks alot. This works now for me:
Code:
$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;
 
Last edited:
Back
Top