icaine / php-mime-mail-parser

Automatically exported from code.google.com/p/php-mime-mail-parser
0 stars 0 forks source link

Writing files not working. #44

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Retrieve attachments (as per example)
2. Write attachments to directory
3. -

What is the expected output? What do you see instead?
Attached file to be written to directory.
Files are not written.
No errors are generated.

What version of the product are you using?
Downloaded today (02-JUL-2014)

On what operating system?
Ubuntu 12.04LTS

Using this code to write files:
foreach($attachments as $attachment) {
  // get the attachment name
  $filename = $attachment->filename;
  $file_list .= $filename."<br>";
  // write the file to the directory you want to save it in
  if ($fp = fopen($save_dir.$filename, 'w')) {
    while($bytes = $attachment->read()) {
      fwrite($fp, $bytes);
    }
    fclose($fp);
  }
}

Original issue reported on code.google.com by jax.contine on 2 Jul 2014 at 8:50