• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 901
  • Last Modified:

Recently upgraded the php of my server and facing file uploading issue

Dear All
recently i upgraded to my php 5.2.17 in 5.4.6 and my php stop working

and give me this error
Warning: move_uploaded_file(./Desktop.ini): failed to open stream: Permission denied in /home/****/****.php on line 11

line 11 is here

if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {

help me to solve this issue
  • 2
  • 2
1 Solution
Loganathan NatarajanLAMP DeveloperCommented:
It is a permission problem for the folder path. Check the folder permission.
That code worked on 5.2.17  or you just wrote that and its not working?
My best guess is to first try to debug it by echoing the $_FILES['uploadedfile']['tmp_name'] , the  $target_path and finally you can try moving something to another location. It seems as logudotcom mentioned , a permission problem.
please feedback your findings.
also , you can use this example ("borrowed" from php.net)

if (is_uploaded_file($_FILES['userfile']['tmp_name'])) {
   echo "File ". $_FILES['userfile']['name'] ." uploaded successfully.\n";
   echo "Displaying contents\n";
} else {
   echo "Possible file upload attack: ";
   echo "filename '". $_FILES['userfile']['tmp_name'] . "'.";

on this you first check if its uploaded and then try to move it.
udayrathorAuthor Commented:
perfect solution
Loganathan NatarajanLAMP DeveloperCommented:
Thanks for your points & comment. Glad to help
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now