File upload in WordPress

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”>

$uploaddir= ‘/home/a796f80a/’;
move_uploaded_file($_FILES[‘attachment’][‘tmp_name’], $attachment);

Read more here:: File upload in WordPress

Leave a Reply

Your email address will not be published. Required fields are marked *