I'm trying to upload a file from my custom HTML form to a PHP script. Here is the code that I have in my HTML.

```
<form action="test.php" method="post" enctype="multipart/form-data">
    <input id="txt" class="button" type = "text" value = "Choose File" onclick       ="javascript:document.getElementById('file').click();">
    <input id = "file" type="file" style='visibility: hidden;' name="img"    onchange="ChangeText(this, 'txt');"/>
   <input type="submit">
</form>

```

Here is the test.php file:

```
ini_set('display_errors',1);
ini_set('display_startup_errors',1);
error_reporting(-1);

$target = "i/";
if (move_uploaded_file($_FILES['img']['tmp_name'], $target)) {
     echo "The file " . basename($_FILES['img']['name']) . "has been uploaded";
} 

```

Here's the error on the page:

> 
> Warning: move\_uploaded\_file(): The second argument to copy() function cannot be a directory in /var/www/BLOCKED/test.php on line 7
> 
> 
> Warning: move\_uploaded\_file(): Unable to move '/tmp/phpNxxB72' to 'i/' in /var/www/BLOCKED/test.php on line 7.
> Yes it's permissions of the directory are 777.
> 
> 
>