• cybermirage

    (@cybermirage)


    I am using version 2.0.5. Currently, I am uploading to both server and storage, i.e. Stores files only in the cloud is unchecked. Local path and filemask are blank, storage prefix set to folder in DO Spaces, and Full URL-path is set to DO Spaces. Website is accessing the files through the storage.

    1) I have to set the Full URL-path to the full URL path at DO Spaces, and not just the storage public domain or subdomain, meaning something like “https://container.sgp1.digitaloceanspaces.com/prefix/wp-content/uploads”

    2) Files are uploaded to the full absolute path in DO Spaces, and not relative path, meaning something like “https://container.sgp1.digitaloceanspaces.com/prefix/home/acct/public_html/wp-content/uploads”

    I found that the upload file path is set in the file_path function in dos_class.php, with the line “$path = str_replace($this->upload_path, ”, $file);”. $file will contain the absolute path, $this->upload_path is empty if I leave local path setting empty. Even if it is “wp-content/uploads”, the file path will still contain the base path at the front.

    Is this the intended behaviour when uploading to both server and storage, or am I missing anything? I just want to upload images to “https://container.sgp1.digitaloceanspaces.com/prefix/” and have them served from there in WordPress.

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author keeross

    (@keeross)

    Okay, let me explain.
    So, for example you want to keep multiple website files in one container, you’ll have to change the prefix for each of these websites, let’s say one of them is production.
    As you changed the prefix, you have to change the full url path, so it will point to exact location, in our example it will become: https://single-container.ams3.cdn.digitaloceanspaces.com/production

    Thread Starter cybermirage

    (@cybermirage)

    Yes, I did just that, so using your example, prefix is set

    production

    and full url path is set to

    https://single-container.ams3.cdn.digitaloceanspaces.com/production

    .

    However, new images are uploaded to

    https://single-container.ams3.cdn.digitaloceanspaces.com/production/home/my-acct/public_html/wp-content/uploads

    . I traced the file path to the line

    $path = str_replace($this->upload_path, ”, $file);

    in the dos_class.php file and the final path seems to be

    /home/my-acct/public_html/wp-content/uploads/image.jpg

    Fyi, I did not use the cdn path, but that should not matter right?

    Thread Starter cybermirage

    (@cybermirage)

    Just to clarify, existing images from the WordPress site are uploaded to the correct folder in DO, and working properly using the prefix and full url path in the way you’ve described.

    It is the new image files uploaded to the WordPress library that is uploaded to the incorrect folder in DO as it will include the base path of the WordPress folder. I can’t change the local path setting as this will then upload to the wrong folder in the WordPress server right?

    Thread Starter cybermirage

    (@cybermirage)

    What I am trying to achieve is for every upload of image file into the library, it will upload the file to the WordPress server in the default folder, e.g.
    /home/my-acct/public_html/wp-content/uploads/image.jpg
    and to DO in the folder
    https://single-container.ams3.cdn.digitaloceanspaces.com/production with the prefix set as production

    Hi,

    I’m experiencing the same issue with @cybermirage (new files being uploaded to DO with their full path e.g. var/www/html), any solution to this?

    Thanks.

    Hi @cybermirage,

    Thanks for pointing out that line, I’ve figured out the problem. I put
    Local path: var/www/html/wp-content/uploads

    After adding a “/” at the beginning
    Local path: /var/www/html/wp-content/uploads

    it works. The full path is not used anymore in DO Spaces. Not sure if this also applies to your case. It’s a bit risky actually with this method of checking, but hey, I’m just another free loader.. Good luck!

    Thanks.

    Thread Starter cybermirage

    (@cybermirage)

    Hi @dickoms

    Your method would work for me and less intrusive since the source code need not be changed. It’s just that local path cannot be left empty as default. I prefer not to change the local path for every WordPress site I have.

    Let’s see if the author decides to change anything for the next update.

    Cheers!

    Any solution how to resolve issue with full path at Digital Ocean?

    I have the same issue as @cybermirage
    Are there any updates on this?

    Local path need to be full path.

    example:

    /var/www/html/wp-content/uploads
    or
    /home/user/domain.com/public_html/wp-content/upload

    Then it’s work perfect with DO Spaces!

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Upload folder at DO Spaces’ is closed to new replies.