Laravel uploading file Unable to write in directory
<p>I'm uploading files in my system and it works locally where am using windows and xampp but when hosting where am using an Ubuntu stack my file is not being uploaded. I'm getting an error that it cannot be written in the 'system' directory which is within the public folder. This is my code    </p>

<pre><code> $destinationPath = public_path().'/system'; // upload path
  $extension = Request::file('add_students')-&gt;getClientOriginalExtension(); // getting excel extension
  // dd($extension);
  $fileName = rand(11111,99999).'.'.$extension; // renameing excel file
  $file=Request::file('add_students')-&gt;move($destinationPath, $fileName); // uploading file to given path
  $path=$file-&gt;getRealPath();
</code></pre>

<p>after looking for solutions I found out that I should make my directory writable so I ran the following command in putty</p>

<p><code>chmod 770 /var/www/html/public/system</code></p>

<p>but still even after that am getting an error <code>Unable to write in the "/var/www/html/public/system" directory</code>.</p>

<p>I'm using laravel 5 and my host is digital ocean. Thanks</p>