Access Denied for php/mysql

  .htaccess, mysql, php, server, web-config

I am currently in a web programming class. When uploading the site to the server, the class as a whole has been having issues working around not having permission to write files or move them. My instructor suggested that a web.config or .htaccess may be a work-around. Will one of these solve the issues? I will include the code that permission is being denied to:

if ($_FILES['screenshot']['error'] == 0) {
                // Move the file to the target upload folder
                $target = GW_UPLOADPATH . $screenshot;
                if (move_uploaded_file($_FILES['screenshot']['tmp_name'], $target)) {
                  // Connect to the database
                  $query = "INSERT INTO guitarwars (date, name, score, screenshot) VALUES (NOW(), '$name', '$score', '$screenshot')";
                  mysqli_query($dbc, $query);

The code deals with having the user upload a screenshot for the site admin to validate.

Source: Ask PHP