开发者

is this the right way to setup an upload path using a variable?

开发者 https://www.devze.com 2023-03-26 00:39 出处:网络
I am trying to upload a document to a folder, whose name is inside the $folder variable.the page goes blank and prints no error but when i connected using ssh and try to open that folder i开发者_开发知

I am trying to upload a document to a folder, whose name is inside the $folder variable. the page goes blank and prints no error but when i connected using ssh and try to open that folder i开发者_开发知识库t says: Permission denied.

This is how i am doing it:

  $upload_path = '/stuff/$folder/';

And this is how i create the folders:

 mkdir("/stuff/$folder", 0700);


First, $upload_path should be set with " :

$upload_path = "/stuff/$folder/";

To access folder with ssh, you need to set different permissions on folder creation. the owner of the folder is the user that running apache on your server (mostly www-data, but the user connected thought ssh is not the same) :

mkdir("/stuff/$folder", 0755);


it usual works with 775 (not to be writable by everyone)

mkdir("/stuff/$folder", 0775);

if that doesn't work try with writable by everyone, it must work

mkdir("/stuff/$folder", 0777);
0

精彩评论

暂无评论...
验证码 换一张
取 消