This topic is locked
[SOLVED]

 Uploaded files permission

3/13/2015 8:05:14 AM
PHPRunner General questions
romaldus author

in Phprunner 7.1 i use the following code to rename uploaded picture:



$fileArray = my_json_decode($values["USER_PHOTO"]);

// rename files

for($i = 0; $i < count($fileArray); $i++)

{

$fileName = $fileArray[$i]["name"];

$newFileName = "images/user_photos/".$values["USER_ID"].".jpg";

rename($fileName, getabspath($newFileName));

$fileArray[$i]["name"] = $newFileName;

}

// update values of the field that stores file names

$values["USER_PHOTO"] = my_json_encode($fileArray);


In My Shared hosting i tried to upload picture but i got this error message in browser :

rename() [function.rename]: Unable to access
[size="2"]than i found this phprunner thread from 2007 to CHMOD uploaded files from 0644 (default chmod for files) into 0777 but no longer compatible with PHPRunner 7.1:[/size]

http://www.asprunner...ploaded-images/
How to solve this problem in PHPRUNNER 7.1?

Sergey Kornilov admin 3/13/2015

This might be an issue with the target folder (images/user_photos). Make sure this folder is writable.

romaldus author 3/13/2015



This might be an issue with the target folder (images/user_photos). Make sure this folder is writable.


Sergey, target folder is writable (775).

Even if i chmod the target folder to 777, cannot solve the problem.

romaldus author 3/14/2015

Solved. I found the solution

edit C:\Program Files (x86)\PHPRunner7.1\source\classes\uploadhandler.php file
in handle_file_upload function,just before

$this->set_file_delete_url($file);

, add the following code :

chmod($file["name"], 0777);