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.
Comments
Post a Comment