I'm tring upload an image on wordpress front end. I built my form where there is:
<input type="file" name="choose_file" id="choose_file" />
And then on click, starts this jquery code:
jQuery('#upload_temp_image_results').load(pathname, {'image': jQuery('#choose_file').val()});
Finally the uploader.php:
if (!function_exists('wp_handle_upload')) require_once('../../../../wp-admin/includes/file.php');
$image = $_POST['image'];
$expire = $_POST['expire'];
echo 'a<img src="'.$image.'"/>a';
echo $image;
echo $expire;
$movefile = wp_handle_upload($image, array( 'test_form' => false ));
if ($movefile)
{
echo "File is valid, and was successfully uploaded.\n";
var_dump( $movefile);
}
else
{
echo "Possible file upload attack!\n";
}
My problem is that i get this error:
Fatal error: Call to undefined function __() in C:\xampp\htdocs\cancellare\wp-admin\includes\file.php on line 13
What's wrong? I need to use my custom form and i can't use wordpress uploader (which is used in admin area).