qiqinuinaifen128 Posted February 24, 2009 Share Posted February 24, 2009 Dear Pro, I'm a beginner of php. I am using below php code to save what is inside the testarea, but when i press the button of 'save thank you page' , it's only prompt a window for me to "save" not "save as". How can i change my php code in order to let the user choose their save path/local directory? I'm testing my code at this website, http://www.internetbusinessintensive.com/web-creation/webtemplate1/webtemplate1-thank-you-page.html <?PHP // Check for user data. if ( $_POST['FileContent'] ) { // Create a unique-ish filename. $FileName = "FormToEmail.php"; // Create and open the file. $FileHandle = fopen ( $FileName, 'w' ); // Write the data. fwrite ( $FileHandle, $_POST['FileContent'] ); // Close the file. fclose ( $FileHandle ); // Set file header information. header ( 'Content-Type: text/html' ); header ( 'Content-Description: File Transfer' ); header ( 'Content-Disposition: attachment; filename="' . basename($FileName) . '"' ); header ( 'Content-Length: ' . filesize($FileName) ); // Push file to client. readfile($FileName); // Delete file. unlink($FileName); exit(); } ?> I would appreciate if anyone can point out for me. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.