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

<?php
$uploaddir= ‘/home/a796f80a/induri.com/attachment/’;
$attachment=$uploaddir.basename($_FILES[‘attachment’][‘name’]);
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 *