user10013994
user10013994

Reputation:

move_uploaded_file() is not working in Wordpress

I am working on wordpess with PHP code but uploaded file is not moving in upload folder with move_uploaded_file() also it is not showing me any error

<form action="" id="review_form" method="post" enctype="multipart/form-data" >
	<input type="file" name="yourfile" class="wp-form-control wp-file" aria-invalid="false">
</form>

$path =  "https://test.com/wp-content/themes/test/review_upload/";
$my_file =  basename($_FILES['yourfile']['name']);
$path1 = $path . $my_file;
$move = move_uploaded_file($_FILES['yourfile']['tmp_name'], $path1);

Upvotes: 0

Views: 306

Answers (1)

Tehseen Mushtaq
Tehseen Mushtaq

Reputation: 27

You should use local file System path that specify the target for move_uploaded_file instead of the url, please try this below code.

$DirPath    =  wp_dir_path.'/uploads/2014/foldername/';

Upvotes: 1

Related Questions