403 (Forbidden) delete file image in themer folder

I'm having trouble with permission to delete files that are within the theme folder. All folders and files are with permission 775 and there is no error in the code , because when I use the code in a directory before the root folder wordpress works.

-The image files are deleted via front-end .

The error:

DELETE http://www.mysite.com.br/wordpress/wp-content/themes/mytheme/cliente/server/php/index.php?file=imagem3.png 

403 (Forbidden)jquery.min.js:4 

It seems that the javascript I'm using does not have permission to delete the files , but it only has to perform upload.

How can I solve this permission ? Or was it this lack of account : wp_enqueue_script

Topic ajax uploads php permissions Wordpress

Category Web


Ok,

As it's front-end... I might:

  1. Set up the folder on the server so that WordPress can read/write (775 or 755 ordinarily works depending on how your server is configured in terms of user/group permissions).

  2. Allow a user on the front end to see the files or choose which file to delete

  3. Upon choosing the file, pass the parameter to an intermediary PHP script

    • /wp-themes/mehmehmeh/deleteFile.php?filename=somefile.ext
  4. In deleteFile.php put the code to do the actual file deletion and report back success/failure to the front-end user.

I am not sure about security on this... I would maybe store details of who owns a given file if its a shared folder and then check that user is the one logged in before allowing them to delete. Sort of a front-end permissions if you will?

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.