Asked  7 Months ago    Answers:  5   Viewed   27 times

I am using this code to upload a document to my server.

if ($_FILES["file"]["error"] > 0){
echo "Error: " . $_FILES["file"]["error"] . "<br>";
echo getcwd().'<br>';
echo "Upload in file named: " . $_FILES["file"]["name"] . "<br>";
$info = pathinfo($_FILES['userFile']['name']);
$ext = pathinfo($_FILES['file']['name'], PATHINFO_EXTENSION);
$target = 'upload/100.'.$ext;
move_uploaded_file( $_FILES['file']['tmp_name'], $target);


I am getting these error message:

Warning: move_uploaded_file( [function.move-uploaded-file]: failed to open stream: Permission denied in on line 14

Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move 'C:WindowsTempphpF64C.tmp' to '' in on line 14

What am I doing wrong? What changes do I need in my code? Please help me in this regard.



The problem is that your folder is not having write permission. And because of that it is not uploading the file.

You have to give it write permission. You can also use chmod for giving write permission to that folder.

Also check who is having that write permission for that folder. When you upload the file from code it is uploaded as Other user.

More info

Wednesday, March 31, 2021
answered 7 Months ago

You should point to your vendor/autoload.php at Settings | PHP | PHPUnit when using PHPUnit via Composer.

This blog post has all the details (with pictures) to successfully configure IDE for such scenario:

Related usability ticket:

P.S. The WI-18388 ticket is already fixed in v8.0

Wednesday, March 31, 2021
answered 7 Months ago

On Mac OS X environment variables available in Terminal and for the normal applications can be different, check the related question for the solution how to make them similar.

Note that this solution will not work on Mountain Lion (10.8).

Saturday, May 29, 2021
answered 5 Months ago

Do f.mkdirs() before f.createNewFile(). You are probably trying to create a new file in a non-existent directory

Thursday, August 5, 2021
answered 3 Months ago

Looks like you need to check in the file with execution permissions. Please try the following from your own machine:

git update-index --add --chmod=+x
git commit -m 'Make executable'
git push
Saturday, September 4, 2021
answered 2 Months ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :