1

I'm actually creating a Android application where i'm using the volley API to send request to a server .

My problem is while uploading an image compressed as String to the server i receive an error message from file_put_contents() saying that : failed to open stream permission denied in

What i did i change the permission of the directory to 777 (not safe ) but it still doing the same thing

Im using a vps as server to test my webservice . here is my code :

$name = $allPOstVariables['imageName'];
$fileContent =  $allPOstVariables['imageFiles'];
$target_dir = "../storage/"+$name;

$decoded_images = base64_decode("$fileContent");
file_put_contents($target_dir,$decoded_images,FILE_APPEND);
Sathish Kumar J
  • 4,280
  • 1
  • 20
  • 48
  • Try a targer dir that is inside the script dir. Or just save to file inside the script dir. – greenapps Jul 12 '16 at 07:51
  • I tried its to doing the same thing. – user3647735 Jul 12 '16 at 14:45
  • Possible duplicate of [file\_put\_contents(meta/services.json): failed to open stream: Permission denied](https://stackoverflow.com/questions/23540083/file-put-contentsmeta-services-json-failed-to-open-stream-permission-denied) – bharat May 09 '19 at 17:47

0 Answers0