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)
Viewing 1 replies (of 1 total)
The topic ‘WordPress file_get_contents returns empty’ is closed to new replies.