The CHMOD in the File Manager doesn't work

Website URL

https://bwshop.great-site.net/

Other Information

I’m trying to change the permissions of the directory “uploads” (placed in /BWShop/immagini/uploads) to 777, but I’m not enable to change them, because when I click the “CHMOD” button, nothing happens

What is the current permission level?
If it is less than 600, you may be better off creating a new hosting account

7 Likes

is it in htdocs?

3 Likes

You cannot change CHMOD of a file/folder here in order to prevent people from locking themselves out of files/folders.
Is there a reason why you need to change the CHMOD to 777?

6 Likes

It’s possible the CHMOD functionality is disabled in the file manager. I’ve never encountered an issue that was fixed setting file permissions, and many issues that were caused by setting it incorrectly.

Can you please explain why you want to change the permissions in the first place? Maybe whatever problem you’re experiencing isn’t fixed by file permissions at all.

8 Likes

the actual permission level is 755

I would like to allow file upload of images in that folder

yes, the path is /htdocs/BWShop/immagini/uploads

ah ok, I understand, I think that’s a good choise. Anyway, I would change the permissions to 777 to enable the file uploads in that folder

I believe you should be able to do it without altering the CHMOD? Do you receive any sort of error messages?

5 Likes

when i try to upload an image i get this error message from the php file, generated in the line where there is the instruction to upload the file. I figured it couldn’t find the directory because of the permissions. The error message is:

Warning: move_uploaded_file(/BWShop/immagini/uploads/utenteFemmina.png): failed to open stream: No such file or directory in /home/vol18_2/infinityfree.com/if0_34794448/htdocs/BWShop/php/AuthSys.php on line 420



Warning: move_uploaded_file(): Unable to move ‘/tmp/phpoe80et’ to ‘/BWShop/immagini/uploads/utenteFemmina.png’ in /home/vol18_2/infinityfree.com/if0_34794448/htdocs/BWShop/php/AuthSys.php on line 420

It seems to be a problem with your code. When it comes to including files, if you add slash to the beginning of the file location then the server will treat it as if it is supposed to be searched on root level which your account has no access to and will throw such error.
Without the slash the server will look for the file inside same directory as the executed php file which means no permission problems should occur.

7 Likes

The temporary name of the file is automatically generated, but now I’ve subtructed the first character from it, and this time it gave me no warnings, but the file upload fails anyway

Can you add this at the first of that name then?

/home/vol18_2/infinityfree.com/if0_34794448/htdocs/BWShop/immagini/uploads/
5 Likes

on my site i use this prefix to access my htdocs

$_SERVER['DOCUMENT_ROOT']

— edit —

here’s a link that explains $_SERVER and some examples

5 Likes

I’ve mody the code in this way:

    $_FILES[$nomeCampoFile]["tmp_name"] = "/home/vol18_2/infinityfree.com/if0_34794448/htdocs/BWShop/immagini/uploads".$_FILES[$nomeCampoFile]["tmp_name"];
    if(!move_uploaded_file($_FILES[$nomeCampoFile]["tmp_name"],$targetFile)){
        var_dump($_FILES[$nomeCampoFile]["tmp_name"]);
        var_dump($targetFile);
        throw new Exception("Si sono verificati problemi con l'upload del file $filename");
    }

But in the console, when I upload the image, it gave me this message: string(88) “/home/vol18_2/infinityfree.com/if0_34794448/htdocs/BWShop/immagini/uploads/tmp/phpepqh0Z”
string(42) “/BWShop/immagini/uploads/utenteFemmina.png”
Si sono verificati problemi con l’upload del file utenteFemmina.png

So the function move_uploaded_file($_FILES[$nomeCampoFile][“tmp_name”],$targetFile) has returned false

3 Likes

You are so close but need to do some modification here is the code which should work hopefully:

$targetFile = "/home/vol18_2/infinityfree.com/if0_34794448/htdocs".$targetFile;
    if(!move_uploaded_file($_FILES[$nomeCampoFile]["tmp_name"],$targetFile)){
        var_dump($_FILES[$nomeCampoFile]["tmp_name"]);
        var_dump($targetFile);
        throw new Exception("Si sono verificati problemi con l'upload del file $filename");
    }
8 Likes

thank you very much, now it works! :smiley: Sorry for the lost time :sweat_smile:

3 Likes

I’ve tried your advice too and it works, thanks a lot! :smiley:

2 Likes

You are welcome :slight_smile: Goodluck with your project!
Now do you believe that it got resolved without altering CHMOD?

7 Likes