WordPress.org

Ready to get started?Download WordPress

Forums

WP Download Codes
Upload folder is ... not a directory I can upload files into (7 posts)

  1. djspur
    Member
    Posted 6 months ago #

    Hi! I'd like to try using this plugin but the directory for uploading is ... not a location to which I can upload any files, and I can't seem to change it; only add to it, making it even more incorrect.

    Here's the current setting:

    /home/myftpname/mysite.com/mywordpressinstallfolder/wp-content/uploads/

    When I use the settings to set an absolute location like

    "http://mysite.com/mywordpressinstallfolder/wp-content/uploads/"

    ...the upload location changes to:

    /home/myftpname/mysite.com/mywordpressinstallfolder/wp-content/uploads/http://mysite.com/mywordpressinstallfolder/wp-content/uploads/

    How can I get the upload location to look for files in a real location?

    Even if there was a place I could edit the plugin, I could just set it?

    Somewhere in here maybe?

    /**
     * Returns the full path of the download file location.
     */
    function dc_file_location() {
    	// Get location of download file (for compatibility of older versions)
    	$dc_file_location = ( '' == get_option( 'dc_file_location' ) ? get_option( 'dc_zip_location' ) : get_option( 'dc_file_location' ) );
    
    	// Check if location is an absolute or relative path
    	if ( strlen( $dc_file_location ) > 0 && '/' == substr( $dc_file_location, 0, 1 ) ) {
    		// Absolute locations are returned directly
    		return $dc_file_location;
    	}
    	else {
    		// Relative locations are returned with the respective upload path directory
    		$wp_upload_dir = wp_upload_dir();
    		$upload_path = get_option( 'upload_path' );
    
    		if ( ( strlen( $upload_path ) > 0 ) && ( substr( $wp_upload_dir['basedir'], 0, strlen( $upload_path ) ) == $upload_path ) ) {
    			return  $upload_path . '/' . $dc_file_location;
    		}
    		else {
    			return $wp_upload_dir['basedir'] . '/' . $dc_file_location;
    		}
    	}
    }

    http://wordpress.org/plugins/wp-download-codes/

  2. misanthrop
    Member
    Plugin Author

    Posted 6 months ago #

    I am not sure if I understand you correctly, but I think you misinterpret the concept of an absolute path and directory.

    The idea is that you provide an internal path - absolute in the sense of the server directory structure - because if you would specify a URL then there would be no straight-forward way for you to secure that location.

    It's really simple, you only have to specify the upload directory in case you do not want to use the standard folder. And then you upload files. You should be able to do that via FTP.

  3. djspur
    Member
    Posted 6 months ago #

    Thank you for your response. I'd like to figure this out with you.

    The standard folder isn't seeing any of the files that are in it.

  4. djspur
    Member
    Posted 6 months ago #

    When I try to add a release, the drop down for a file is always empty.

  5. misanthrop
    Member
    Plugin Author

    Posted 5 months ago #

    To identify your upload path, I am simply using the standard function wp_upload_dir() and this works in most of the cases. If not, you might have to find out either what your actual absolute path to the upload folder is (e.g. using realpath() or similar) or you might check the permissions granted on the folder to the user under whose credentials WordPress accesses the folder.

  6. djspur
    Member
    Posted 5 months ago #

    Hi, thanks for your replies.

    I'm sure you know what you're talking about, but I don't yet understand how to take action on your words yet. I don't know what to change, or where, to get things to work.

    The directories that are displayed in the Download Codes plugin have 755 or 777 permissions at the moment, and seem to be working for other download / upload / file management plugins I have installed.

    Perhaps the issue is related to a plugin conflict of some type? I have disabled other non-essential download plugins but still cannot get Download Codes to find any files yet.

    Maybe I'll try installing the plugin into different WP installations I have on different domains to see if the issue is limited to this installation.

    Until then, I just see a blank drop-down no matter how much I play with the interface.

    Some other observations:

    1)
    When I chose a directory from the "Location of download files" setting, I couldn't set it back to the original "none selected" setting.

    So, my directory structure is:

    wp-content/uploads/2013
    (and)
    wp-content/uploads/2014
    (etc.)

    After I selected /2013 there was no way to go back to /uploads in the future. It seems I will forever be only able to navigate to releases within the uploads folder. This is fine, but confusing as to why I can't change it back to where it started.

    ~

    2)
    For terminology, I recommend you might want to consider altering the verbiage in this help statement on the settings page: "If the upload folder cannot be determined or if the release management does not work (or if you want to have another download file location) you may specify the absolute path of the download file location here:"

    The word "absolute" in this sentence almost makes it seems as though that field allows typing in a URL for ...some type of upload operation. The whole phrase "you may specify the absolute path of the download file location here" leads me to believe I can type in a URL. Some other plugins have options like this. In my experience that verbiage was confusing. Instead it's appending a subdirectory (for me).

    So, the instruction for that field might be something like: "Enter your own subdirectory:"

    3)
    Also, there is no clear way to remove whatever is submitted into that field either. I found if I entered a [space] and saved, it was deleted. This could be more intuitive.

    So having some sort of "Clear" feature for that field might be helpful.

    ~

    All of this is to say I think you have a promising plugin and I hope it is useful for many people. At this time I was unable to get the file management to work for me, but maybe in a different installation or a future revision everything will go smoothly.

    Thanks for your time!

  7. djspur
    Member
    Posted 5 months ago #

    I should also apologize for the subject (title) of the thread -- after further examination, can upload files to the locations listed. I just haven't gotten the plugin to see any of the files there are there (yet). Unfortunately it seems too late to alter the thread title.

Reply

You must log in to post.

About this Plugin

About this Topic

Tags