[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 898
  • 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
0
udayrathor
Asked:
udayrathor
  • 2
  • 2
1 Solution
 
Loganathan NatarajanLAMP DeveloperCommented:
It is a permission problem for the folder path. Check the folder permission.
0
 
stergiumCommented:
Hello.
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.
0
 
stergiumCommented:
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";
   readfile($_FILES['userfile']['tmp_name']);
} 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.
0
 
udayrathorAuthor Commented:
perfect solution
0
 
Loganathan NatarajanLAMP DeveloperCommented:
Thanks for your points & comment. Glad to help
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

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