Why is this file not uploading?
<p>PHP:</p>

<p>

<pre><code>// If the user accessed the page by form submittal
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    $filename = $_FILES["file-input"]["name"];
    $extension = pathinfo($filename, PATHINFO_EXTENSION);
    $filesize = filesize($filename);
    $max_filesize = 524288;
// Array to hold errors
    $errors = array();

                if (!$filename) {
                    array_push($errors, "You didn't actually upload anything!");
            }
            else if ($extension != "txt") {
                    array_push($errors, "That's not a valid file-type. Please only use txt files.");
            }
            else if (filesize($filename)) {
                array_push($errors, "The txt file must not be empty. Give us a good story.");
            }
</code></pre>

<p>HTML:</p>

<pre><code>&lt;div class="upload-form"&gt;
&lt;form action="" method="post" enctype="multipart/form-data"&gt;
&lt;div class="upload"&gt;
&lt;input type="file" name="file-input"&gt;
&lt;span class="input-filename"&gt;Select a file...
    &lt;/span&gt;
    &lt;input type="button" value="Browse"&gt;
&lt;/div&gt;

                &lt;input type="submit" name="submit" value="Upload"&gt;
                &lt;span class="valid-formats"&gt;Valid input: .txt files &amp;lt;= 512 KB&lt;/span&gt;
            &lt;/form&gt;
        &lt;/div&gt;
</code></pre>

<p>I get the errors:</p>

<blockquote>
  <p>Warning: filesize(): stat failed for todo.txt in
  .../Dropbox/Projects/Website
  Projects/serverside/assignment2/index.php on line 34</p>
  
  <p>Warning: filesize(): stat failed for todo.txt in
  .../Dropbox/Projects/Website
  Projects/serverside/assignment2/index.php on line 46</p>
  
  <p>Warning: file_get_contents(todo.txt): failed to open stream: No such
  file or directory in .../Dropbox/Projects/Website
  Projects/serverside/assignment2/index.php on line 77</p>
</blockquote>
