title: Trying to get filesize from a file on mysql database with php
body: <p>I have been searching for a while through here, and several other places via google, and have had no luck finding an answer thus far. Either I'm not using the correct search terms, or no answer exists for my specific issue.</p>
  
  <p>I have a ftp site that is protected by a user-authentication system (only admins can upload and delete files from the server, anyone can download), and I have it fixed to be able to upload the file to the database, but when I view the download page which lists all files available in the database, I get the following error:</p>
  
  <blockquote>
    <p>Warning: filesize() expects parameter 1 to be a valid path, string given in /usr/www/cgcserver/public/download.php on line 31</p>
  </blockquote>
  
  <p>On line 31 of my code for that page, I have:</p>
  
  <pre><code>$bytes = filesize($content);
  </code></pre>
  
  <p>The code block for the page pertaining to that line of code is:</p>
  
  <pre><code>$query = "SELECT id, name, creator, content FROM upload";
  $result = $mysqli-&gt;query($query);
  if(mysqli_num_rows($result) == 0)
  {
      echo "Database is empty &lt;br&gt;";
  }
  else
  {
      while(list($id, $name, $creator, $content) = mysqli_fetch_array($result))
      {
          $bytes = filesize($content);
  ?&gt;
  &lt;tr&gt;&lt;td&gt;&lt;a href="download.php?id=&lt;?php $id; ?&gt;"&gt;&lt;?php $name . ' - ' .bytesToSize($bytes); ?&gt;&lt;/a&gt;&lt;/td&gt;&lt;td&gt;&lt;?php $creator; ?&gt;&lt;/td&gt;&lt;/tr&gt;
  </code></pre>
  
  <p>I am trying to pull the filesize from the database, and display it next to the download link so users know how big it is before they download.  The bytesToSize is just a function I have to convert the filesize() into bytes, kb, mb, etc.</p>
  
  <p>Any insight as to what I am doing wrong, would be greatly appreciated.</p>
  
  <p>Please note the file itself is stored in the database in the variable "content"</p>