問題がわかりにくいかもしれませんが、こちらで説明させて頂きます。
フォームで入力欄があって、そこに入力したものを送信すると、サーバー上にcsvファイルとzipファイルが作成されて、zipファイル添付のメールが飛んで、メール本文のurlをクリックするとzipファイルがダウンロードされ、ダウンロードしたファイルを開くにはパスワードが必要で、そのパスワードは入力欄で入力した数値という仕組みです。
現在、エラーがでていまして、うまく行かないです。エラー文ではそのようなものは存在しませんとのことで、zipファイルがサーバー上で作られていない。下にコード貼ります。
エラー文をご覧ください↓↓
Warning: file_get_contents(text.zip) [function.file-get-contents]: failed to open stream: No such file or directory in /home/blotag/www/ryu/csv/send.php on line 72
送信完了
説明が下手ですみません。
回答よろしくお願いいたします。
php
1$ShiftJIS = array($_POST['moji'], date("Y年/m月/d日 H時i分s秒")); 2 mb_convert_variables('Shift_JIS', 'UTF-8', $ShiftJIS); 3 4chmod('../csv', 766); 5 6$csv = fopen('text.csv', 'w'); 7 fputcsv($csv, $ShiftJIS); 8 fclose($csv); 9 10chmod('../csv',755 ); 11 12 13exec('zip -P $moji text.zip text.csv '); 14 15 16 17 18 mb_language("Japanese"); 19 mb_internal_encoding("UTF-8"); 20 21 22 23 24 25$filepath = "http://blotag.sakura.ne.jp/ryu/csv/text.zip"; 26$boundary = "__BOUNDARY__"; 27 28$additional_headers = "Content-Type: multipart/mixed;boundary=\"" . $boundary . "\"\n"; 29$additional_headers .= "From:xxxxxxxx.co.jp"; 30 31$message = "--" . $boundary . "\n"; 32 33$message .= "Content-Type: text/plain; charset=\"ISO-2022-JP\"\n\n"; 34 35$message .= "http://blotag.sakura.ne.jp/ryu/csv/text.zip\n"; 36$message .= "--" . $boundary . "\n"; 37 38$message .= "Content-Type: application/zip\n"; 39$message .= "Content-Disposition: attachment; filename=\"text.zip\n"; 40$message .= "Content-Transfer-Encoding: base64\n"; 41$message .= "\n"; 42$message .= chunk_split(base64_encode(file_get_contents('text.zip')))."\n"; 43 44$message .= "--" . $boundary . "--"; 45 46 47 48$to = "xxxxxx.co.jp"; 49$subject = "hey"; 50$send_mail = mb_send_mail($to, $subject, $message, $additional_headers); 51 if ( $send_mail ) { 52 echo "送信完了"; 53 }else { 54 echo "メールを送信できませんでした。"; 55 }
回答3件
あなたの回答
tips
プレビュー