Title: email attachment/file create problem
Last modified: September 19, 2016

---

# email attachment/file create problem

 *  [guylancaster](https://wordpress.org/support/users/guylancaster/)
 * (@guylancaster)
 * [9 years, 8 months ago](https://wordpress.org/support/topic/email-attachmentfile-create-problem/)
 * I want to send a user a file from contents I have in a $variable
 * Option 1: A C: drive directory browser and a fopen-fwrite-fclose to create the
   file in that directory
    Option 2:Creating the file in the the wordpress file 
   space, and attaching it as an email, using headers Option 3: Create an email 
   with the contents of the $variable as an attachment using headers
 * I have more or less done all this before but cant get working now, as the files
   arnt creating. For Option 2, I tried setting permissions to 666 or 777 but no
   good.
 * $hdl=fopen(“/home/sites/xxx/public_html/yyy/wp-content/plugins/pluginname/file.
   csv”);
    fwrite($hdl,”12345″); fclose($hdl);

The topic ‘email attachment/file create problem’ is closed to new replies.

## Tags

 * [attachment](https://wordpress.org/support/topic-tag/attachment/)
 * [email](https://wordpress.org/support/topic-tag/email/)

 * 0 replies
 * 1 participant
 * Last reply from: [guylancaster](https://wordpress.org/support/users/guylancaster/)
 * Last activity: [9 years, 8 months ago](https://wordpress.org/support/topic/email-attachmentfile-create-problem/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
