Title: WordPress file_get_contents returns empty
Last modified: August 30, 2016

---

# WordPress file_get_contents returns empty

 *  [warrebuysse](https://wordpress.org/support/users/warrebuysse/)
 * (@warrebuysse)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/wordpress-file_get_contents-returns-empty/)
 * After submission of the contact form I hook in on the submission. The file, uploaded
   on the contact form, need to be send to a SOAP service. In order to receive the
   filedata I do the following:
 * Returns empty:
 *     ```
       $base64string = base64_encode(file_get_contents($_FILES["cv"]["tmp_name"]));
       ```
   
 * My $_FILES is not empty, so the file is in place. file_get_contents **always**
   returns an empty string. also, allow_url_fopen is on “On”
 * When I test this on a single PHP file (no WordPress) it returns the BASE_64 string
   so it has to do something with WordPress:
 * Working code:
 *     ```
       <form action="" method="POST" enctype="multipart/form-data">
       		<input type="file" name="cv">
       		<input type="submit" name="formsubmit">
       	</form>
       	<?
   
       	if(isset($_POST['formsubmit'])){
       		print_r(base64_encode(file_get_contents($_FILES["cv"]["tmp_name"])));
       	}
       ```
   
 * Any ideas?

Viewing 1 replies (of 1 total)

 *  Thread Starter [warrebuysse](https://wordpress.org/support/users/warrebuysse/)
 * (@warrebuysse)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/wordpress-file_get_contents-returns-empty/#post-6718804)
 * To be clear, I use the Contact Form 7 plugin for this and hook in before submitting
   the form.

Viewing 1 replies (of 1 total)

The topic ‘WordPress file_get_contents returns empty’ is closed to new replies.

## Tags

 * [file](https://wordpress.org/support/topic-tag/file/)
 * [file_get_contents](https://wordpress.org/support/topic-tag/file_get_contents/)
 * [upload](https://wordpress.org/support/topic-tag/upload/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 1 participant
 * Last reply from: [warrebuysse](https://wordpress.org/support/users/warrebuysse/)
 * Last activity: [10 years, 7 months ago](https://wordpress.org/support/topic/wordpress-file_get_contents-returns-empty/#post-6718804)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
