I have this problem.
Warning: strpos() expects parameter 1 to be string, object given in /home/faizalia/public_html/wp-includes/post.php on line 277
Warning: preg_match() expects parameter 2 to be string, object given in /home/faizalia/public_html/wp-includes/post.php on line 277
Catchable fatal error: Object of class WP_Error could not be converted to string in /home/faizalia/public_html/wp-includes/post.php on line 278
Line 277 :
if ( $file && 0 !== strpos( $file, '/' ) && ! preg_match( '|^.:\\\|', $file ) && ( ( $uploads = wp_get_upload_dir() ) && false === $uploads['error'] ) ) {
Line 278:
$file = $uploads['basedir'] . "/$file";
Any solutions?
You may want to use
$_FILES["myfilename"]["name"];
or stringify $file using:
(string)$file