file upload - What am I getting a 'Failed to open Stream' error in PHP? -


i have been following set of tutorials in thenewboston [php] , have been using following code. trying upload file, more on 'jpg' file, since it's first time upload file. code though, have been encountering several errors such ff:
- move_uploaded_file: failed open stream: permission denied
- move_uploaded_file: unable move 'tmp_file' 'file'

so, doing wrong?

    $name = $_files['file']['name'];     $tmp_name = $_files['file']['tmp_name'];         if (!empty($name)) {            $folder = 'files/';              if (move_uploaded_file($tmp_name, $folder.'image.jpg')) {                 echo 'uploaded';              }        }   ?>  <form method="post" enctype="multipart/form-data" action="untitled%20text.php"> <input type="file" name="file"/> <br/> <br/> <input type="submit"/> </form> 

--------- edited (december 23, 2015)

coming answers, made conclusion folders permissions produce "failed open stream" error because php code (user) has no permission touch file.

try change folder permission,

chmod 777 folder_path  

refer link


Comments

Popular posts from this blog

c++ - Delete matches in OpenCV (Keypoints and descriptors) -

java - Could not locate OpenAL library -

sorting - opencl Bitonic sort with 64 bits keys -