Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP move_uploaded_file not working but no errors either?
    primarykey
    data
    text
    <p>I'm trying to move my uploaded file to a pictures folder. I dont get any errors when it comes to the script. Im using godaddy as the host. All file permissions are set up correctly. Have really no idea what else to do.</p> <p>This is the php code:</p> <pre><code>&lt;?php public function CheckPicture($picture){ if(empty($_FILES['picture']['name'])){ echo "Must choose a file."; }else{ $allowed = array('jpg', 'jpeg', 'png'); $file_name = $_FILES['picture']['name']; //line 157-&gt;$file_extn = strtolower(end(explode('.', $file_name))); $file_temp = $_FILES['picture']['tmp_name']; if(in_array($file_extn, $allowed)){ $this-&gt;UploadPicture($username, $file_name, $file_extn); }else{ echo $file_extn; echo "Incorect file type. Types allowed: "; echo implode(', ' , $allowed); } } } public function UploadPicture($username, $file_temp, $file_extn){ ini_set('display_errors',1); error_reporting(E_ALL); $file_path = '/home/content/49/11554349/html/gb/dev/images/pictures/' . substr(md5(time()), 0 , 9) . '.' . $file_extn; move_uploaded_file($file_temp, $file_path); echo $file_path; print_r("$file_temp"); } ?&gt; </code></pre> <p>This is how I am calling it in the html:</p> <pre><code>&lt;?php session_start(); include_once('post.php'); $username = unserialize($_SESSION["username"]); $email = $_SESSION["email"]; if(!$_SESSION["username"]){ header("Location: http://www.greenboardapp.com/dev/"); } if(isset($_FILES['picture'])){ $upload = new Post(); $upload-&gt;CheckPicture($picture); } ?&gt; </code></pre> <p>This is the form:</p> <pre><code>&lt;div class="tile"&gt; &lt;img src="images/profileimg.png" alt="Tutors" class="tile-image"&gt; &lt;form action="profile.php" method="post" enctype="multipart/form-data"&gt; &lt;label for="file"&gt;Filename:&lt;/label&gt; &lt;input type="file" name="picture"&gt;&lt;br&gt; &lt;h6&gt;&lt;input type="submit" value="Change Profile Pic" class="btn btn-hg btn-success"&gt;&lt;/h6&gt; &lt;/form&gt; &lt;/div&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload