• Resolved hausmanconsulting

    (@hausmanconsulting)


    I’m trying this plugin on a new WordPress site, and it works fine if I leave uploadpath blank (uploads to wp-content). But I’m trying to upload to a subdirectory of another plugin, which has been working on another site for years, and I always get “Not allowed to upload to target folder.”

    The upload path is correct, and the account has unix permissions to write all the way down the folder tree. I can’t tell if this is some new WordPress security feature or if I’m doing something else wrong – anyone have any ideas? I tried deactivating Sucuri and that didn’t make a difference.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author nickboss

    (@nickboss)

    Good morning,

    what is the shortcode of the upload form?

    Best Regards

    Nickolas

    Thread Starter hausmanconsulting

    (@hausmanconsulting)

    Good morning. Here is the shortcode (I will try to go back and edit if those shortcodes don’t format correctly here):

    [wordpress_file_upload uploadpath="plugins/s2member-files/" uploadrole="editor,administrator" forcefilename="true" askforsubfolders="true" subfoldertree="auto" adminmessages="true" debugmode="true" placements="title/selectbutton/filename/subfolders/uploadbutton/userdata/message" uploadtitle="Upload Files (only visible to Admins & Editors):" selectbutton="Select File…" uploadbutton="Upload" subfolderlabel="Select Folder:" successmessage="File %filename% uploaded successfully. RELOAD to view." widths="filename:300px"]

    And when it fails, the detailed error is:

    Upload failed!
    Not allowed to upload to target folder. Failed upload path: /home/REDACTED/REDACTED/wp-content/plugins/s2member-files/Documents/test.pdf

    That is the correct path. I ended up altering the shortcode to this, which works:

    [wordpress_file_upload uploadpath="uploads/s2member-files/" uploadrole="editor,administrator" forcefilename="true" askforsubfolders="true" subfoldertree="auto" adminmessages="true" debugmode="true" placements="title/selectbutton/filename/subfolders/uploadbutton/userdata/message" uploadtitle="Upload Files (only visible to Admins & Editors):" selectbutton="Select File…" uploadbutton="Upload" subfolderlabel="Select Folder:" successmessage="File %filename% uploaded successfully. RELOAD to view." widths="filename:300px"]

    The drawback is that I had to apply another function to move the file location in s2member. I have WFU writing to plugins/s2member-files in another (older) wordpress installation, so I’m just not sure why it doesn’t work here. No errors in the server logs either.

    Plugin Author nickboss

    (@nickboss)

    Good morning, I see no reason why it shouldn’t work.

    I suppose the ownership of the folder is the same as uploads folder.

    Is there any .htaccess file in /plugins or plugins/s2member-files/ folder?

    Nickolas

    Plugin Author nickboss

    (@nickboss)

    I am marking it as resolved. Please reopen it if you still need support on this.

    Nickolas

    Thread Starter hausmanconsulting

    (@hausmanconsulting)

    Sorry for not following up, Nickolas. My solution was to move the target folder into /wp-content/uploads/, which worked. I never did figure out why I wasn’t able to upload to /wp-content/plugins.

    Edit: Answering your previous question, there are .htaccess files in the target directories on both sites (the one that works and the one that fails) and they are identical.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Not allowed to upload to target folder.’ is closed to new replies.