- // Get the file data and mime type
- $fileData = "This would be the data from your email array";
- $fileMime = "image/jpeg"; // Or whatever
- // Set file path and create the file name
- $filePath = "/path/to/your/tmp/dir/";
- $fileName = "temp_file_". microtime(true) .".tmp";
- // Save file and print link, or error if it fails
- if(file_put_contents($filePath . $fileName, $fileData)) {
- echo "Click <a href='readFile.php?fName={$fileName}&mime={$fileMime}'>here</a> to download</a>";
- else {
- echo "Failed to save the file! Make sure you have write permission.";
- }

