I am trying to upload a file through a custom form into WordPress directory but not able to upload it. My code is:
<input type="file" name="attachment">
<?php
$uploaddir= '/home/a796f80a/induri.com/attachment/';
$attachment=$uploaddir.basename($_FILES['attachment']['name']);
move_uploaded_file($_FILES['attachment']['tmp_name'], $attachment);
?>
the error I am getting: Array ( [attachment] => Array ( [name] => testfile.txt [type] => text/plain [tmp_name] => /tmp/phpGZYCbR [error] => 0 [size] => 0 ) )