I am trying to store the local path to an uploaded file as a meta for a custom post type, using the following code:
$upload = wp_handle_upload ( $_FILES [WPSM_MAIL_META_ATTACHMENT], array ('test_form' => false ) );
if ((isset ( $upload ['error'] )) && ($upload ['error'] != 'Specified file failed upload test.')) {
die ( $upload ['error'] );
} else {
$path = $upload['file'];
//$path = 'C:\Users\Brady\Music\Honour, Valour, Pride';
update_post_meta ( 34, WPSM_MAIL_META_ATTACHMENT, $path );
}
With the $path = $upload['file']
call I get that $path
contains "C:\xampp\htdocs\wordpress/wp-content/uploads/2011/12/ReSharper-6.1-License18.txt", but my *post_meta* row for this post has a empty *meta_value* column after the update. When I use the commented out assignment of a test literal to $path
, the meta_value column is properly updated to the text path string.
I'm truly lost here. How can two string arguments to the same function call have such different effects?