• Resolved bekee

    (@bekee)


    Howdy! I’m working on an s2Member site and need to allow my users to upload PDFs to the /wp-content/plugins/s2member-files directory as that dir is content-restricted by default. There is an .htaccess file in this folder which does all the work to keep the folder restricted.

    Here is the shortcode I’m using (for testing, right now):

    [wordpress_file_upload uploadid="1" uploadpath="plugins/s2member-files" uploadrole="administrator" createpath="false" showtargetfolder="true" adminmessages="true" debugmode="true"]

    The folder is chmod 777.

    Let me know if the contents of the .htaccess are important and I can paste them in a reply.

    This issue appears to be the same as in this thread https://www.ads-software.com/support/topic/not-allowed-to-upload-to-target-folder/

    • This topic was modified 1 year, 3 months ago by bekee.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author nickboss

    (@nickboss)

    Good morning, so I suppose the problem is that you cannot upload files there?

    This is due to .htaccess.

    Can you send me the contents of .htaccess as well?

    Nickolas

    Thread Starter bekee

    (@bekee)

    Sorry, I wasn’t explicit about the problem. Yes, I need to be able to upload files to this folder but I get an error that it is not allowed.

    Here are the contents of .htaccess from s2member. I’m using the free version if you want to test with the plugin.

    <IfModule env_module>
    # No GZIP for script-based file downloads.
    	SetEnv no-gzip 1
    </IfModule>
    
    <IfModule rewrite_module>
    # Enable symlinks (required for rewrites).
    	Options +FollowSymLinks
    
    # Enable rewrite and configure base.
    	RewriteEngine On
    	RewriteBase /
    
    # Initialize all environment variables we're using below.
    	RewriteCond %{ENV:s2member_file_download_setup} !^complete$
    	RewriteRule ^(.*)$ - [E=s2member_file_download_wp_vdir:0,E=s2member_file_download:$1,E=s2member_file_stream:0,E=s2member_file_inline:0,E=s2member_file_storage:0,E=s2member_file_remote:0,E=s2member_file_ssl:0,E=s2member_file_download_key:0,E=s2member_skip_confirmation:0,E=s2member_file_download_setup:complete]
    
    # Handle virtual directories, common on multisite networks.
    	RewriteCond %{ENV:s2member_file_download_wp_vdir_check} !^complete$
    	RewriteCond %{THE_REQUEST} ^(?:GET|HEAD)(?:[\ ]+)(?:/)([_0-9a-zA-Z\-]+/)(?:wp-content/)
    	RewriteRule ^(.*)$ - [E=s2member_file_download_wp_vdir:,E=s2member_file_download_wp_vdir:%1,E=s2member_file_download_wp_vdir_check:complete]
    
    # Handle streaming download requests via the rewrite engine.
    	RewriteCond %{ENV:s2member_file_download} ^(.*?)(?:s2member-file-stream/)(.+)$
    	RewriteRule ^(.*)$ - [N,E=s2member_file_download:,E=s2member_file_download:%1%2,E=s2member_file_stream:,E=s2member_file_stream:&s2member_file_stream=yes]
    
    	RewriteCond %{ENV:s2member_file_download} ^(.*?)(?:s2member-file-stream-(.+?)/)(.+)$
    	RewriteRule ^(.*)$ - [N,E=s2member_file_download:,E=s2member_file_download:%1%3,E=s2member_file_stream:,E=s2member_file_stream:&s2member_file_stream=%2]
    
    # Handle inline file requests via the rewrite engine.
    	RewriteCond %{ENV:s2member_file_download} ^(.*?)(?:s2member-file-inline/)(.+)$
    	RewriteRule ^(.*)$ - [N,E=s2member_file_download:,E=s2member_file_download:%1%2,E=s2member_file_inline:,E=s2member_file_inline:&s2member_file_inline=yes]
    
    	RewriteCond %{ENV:s2member_file_download} ^(.*?)(?:s2member-file-inline-(.+?)/)(.+)$
    	RewriteRule ^(.*)$ - [N,E=s2member_file_download:,E=s2member_file_download:%1%3,E=s2member_file_inline:,E=s2member_file_inline:&s2member_file_inline=%2]
    
    # Handle storage specifications via the rewrite engine.
    	RewriteCond %{ENV:s2member_file_download} ^(.*?)(?:s2member-file-storage-(.+?)/)(.+)$
    	RewriteRule ^(.*)$ - [N,E=s2member_file_download:,E=s2member_file_download:%1%3,E=s2member_file_storage:,E=s2member_file_storage:&s2member_file_storage=%2]
    
    # Handle remote authorization requests via the rewrite engine.
    	RewriteCond %{ENV:s2member_file_download} ^(.*?)(?:s2member-file-remote/)(.+)$
    	RewriteRule ^(.*)$ - [N,E=s2member_file_download:,E=s2member_file_download:%1%2,E=s2member_file_remote:,E=s2member_file_remote:&s2member_file_remote=yes]
    
    	RewriteCond %{ENV:s2member_file_download} ^(.*?)(?:s2member-file-remote-(.+?)/)(.+)$
    	RewriteRule ^(.*)$ - [N,E=s2member_file_download:,E=s2member_file_download:%1%3,E=s2member_file_remote:,E=s2member_file_remote:&s2member_file_remote=%2]
    
    # Handle SSL file requests via the rewrite engine.
    	RewriteCond %{ENV:s2member_file_download} ^(.*?)(?:s2member-file-ssl/)(.+)$
    	RewriteRule ^(.*)$ - [N,E=s2member_file_download:,E=s2member_file_download:%1%2,E=s2member_file_ssl:,E=s2member_file_ssl:&s2member_file_ssl=yes]
    
    	RewriteCond %{ENV:s2member_file_download} ^(.*?)(?:s2member-file-ssl-(.+?)/)(.+)$
    	RewriteRule ^(.*)$ - [N,E=s2member_file_download:,E=s2member_file_download:%1%3,E=s2member_file_ssl:,E=s2member_file_ssl:&s2member_file_ssl=%2]
    
    # Handle file download keys via the rewrite engine.
    	RewriteCond %{ENV:s2member_file_download} ^(.*?)(?:s2member-file-download-key-(.+?)/)(.+)$
    	RewriteRule ^(.*)$ - [N,E=s2member_file_download:,E=s2member_file_download:%1%3,E=s2member_file_download_key:,E=s2member_file_download_key:&s2member_file_download_key=%2]
    
    # Handle confirmations having beek skipped via the rewrite engine.
    	RewriteCond %{ENV:s2member_file_download} ^(.*?)(?:s2member-skip-confirmation/)(.+)$
    	RewriteRule ^(.*)$ - [N,E=s2member_file_download:,E=s2member_file_download:%1%2,E=s2member_skip_confirmation:,E=s2member_skip_confirmation:&s2member_skip_confirmation=yes]
    
    	RewriteCond %{ENV:s2member_file_download} ^(.*?)(?:s2member-skip-confirmation-(.+?)/)(.+)$
    	RewriteRule ^(.*)$ - [N,E=s2member_file_download:,E=s2member_file_download:%1%3,E=s2member_skip_confirmation:,E=s2member_skip_confirmation:&s2member_skip_confirmation=%2]
    
    # Cleanup variables not used in this request. Looking for 0 values.
    	RewriteCond %{ENV:s2member_file_download_wp_vdir} ^0$
    	RewriteRule ^(.*)$ - [E=s2member_file_download_wp_vdir:]
    
    	RewriteCond %{ENV:s2member_file_stream} ^0$
    	RewriteRule ^(.*)$ - [E=s2member_file_stream:]
    
    	RewriteCond %{ENV:s2member_file_inline} ^0$
    	RewriteRule ^(.*)$ - [E=s2member_file_inline:]
    
    	RewriteCond %{ENV:s2member_file_storage} ^0$
    	RewriteRule ^(.*)$ - [E=s2member_file_storage:]
    
    	RewriteCond %{ENV:s2member_file_remote} ^0$
    	RewriteRule ^(.*)$ - [E=s2member_file_remote:]
    
    	RewriteCond %{ENV:s2member_file_ssl} ^0$
    	RewriteRule ^(.*)$ - [E=s2member_file_ssl:]
    
    	RewriteCond %{ENV:s2member_file_download_key} ^0$
    	RewriteRule ^(.*)$ - [E=s2member_file_download_key:]
    
    	RewriteCond %{ENV:s2member_skip_confirmation} ^0$
    	RewriteRule ^(.*)$ - [E=s2member_skip_confirmation:]
    
    # Put everything together now and process the internal rewrite.
    	RewriteRule ^(.*)$ %{ENV:s2member_file_download_wp_vdir}?s2member_file_download=%{ENV:s2member_file_download}%{ENV:s2member_file_stream}%{ENV:s2member_file_inline}%{ENV:s2member_file_storage}%{ENV:s2member_file_remote}%{ENV:s2member_file_ssl}%{ENV:s2member_file_download_key}%{ENV:s2member_skip_confirmation} [QSA,L]
    </IfModule>
    
    <IfModule !rewrite_module>
    	<IfModule authz_core_module>
    		Require all denied
    	</IfModule>
    	<IfModule !authz_core_module>
    		deny from all
    	</IfModule>
    </IfModule>

    Thank you for taking the time to look at this. I appreciate it!

    Plugin Author nickboss

    (@nickboss)

    One quick way to solve the problem is to use ftp uploads.

    So you need to open the visual editor of the upload form, go to General tab, locate option Folder Access Method and set it to ftp.

    Then you need to set ftp credentials and also set Use FTP Domain to true.

    You also need to change the upload path, based on your ftp root.

    If everything is set correctly then the files will be stored in s2member-files folder.

    I tested it in my environment.

    Nickolas

    Thread Starter bekee

    (@bekee)

    Awesome, thank you for this! I appreciate your support. Cheers!

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