Thursday 30 November 2017

php - The second argument to copy() function cannot be a directory and move_uploaded_file(): Unable to move





in the
code



if(isset($_POST['submit'])){



$post_image=$_FILES['post_image']['name'];


$post_image_tmp=$_FILES['post_image']['tmp_name'];


if($post_image='' ){
echo "";
exit();


}
else{

move_uploaded_file($post_image_tmp,"news_images/$post_image");

?>


I
get this error





Warning: move_uploaded_file(): The second argument to copy()
function
cannot be a directory in
C:\xampp\htdocs\MyCMS\admin\insert_post.php
on line 107





Warning: move_uploaded_file(): Unable to move

'C:\xampp\tmp\php946C.tmp' to 'news_images/' in

C:\xampp\htdocs\MyCMS\admin\insert_post.php on line
107




Please help
I'am just newbie.


itemprop="text">
class="normal">Answer



= is
assignment operator.
use comparison operator ==
here.




if($post_image ==
'' ) {

No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...