• Welcome to the Chevereto User Community!

    Here, users from all over the world come together to learn, share, and collaborate on everything related to Chevereto. It's a place to exchange ideas, ask questions, and help improve the software.

    Please keep in mind:

    • This community is user-driven. Always be polite and respectful to others.
    • Support development by purchasing a Chevereto license, which also gives you priority support.
    • Go further by joining the Community Subscription for even faster response times and to help sustain this space
  • Chevereto Support CLST

    Support response

    Support checklist

    • Got a Something went wrong message? Read this guide and provide the actual error. Do not skip this.
    • Confirm that the server meets the System Requirements
    • Check for any available Hotfix - your issue could be already reported/fixed
    • Read documentation - It will be required to Debug and understand Errors for a faster support response

FTP Storage Failing to Create Folders (Uploading to Parent Month Folder Instead)

Version
4.5.7
Website URL
https://www.imageride.net
PHP version
8.2.33
Database driver
MariaDB
Database version
10.11.19
Web browser
Firefox, Edge, Chrome

rsunny2012

Chevereto Member
Hi everyone,

I am running into a sudden issue where Cheverto has stopped automatically creating the daily subfolders (e.g., /2026/08/26/) for my FTP storage.

Instead of creating the new 26 folder, the FTP upload just drops the new images directly into the parent /2026/08/ folder. Because the Cheveerto database generates the URL expecting the image to be inside the daily folder, it results in broken image links (404s) and blank images on the frontend.

Here is what I have already verified as root via SSH:

  • Permissions are correct: Directories are 755 and files are 644.
  • Ownership is correct: The FTP/cPanel user strictly owns all the folders
  • Not a disk space/quota issue: The server and FTP account have plenty of space and inodes. We know this because the images are successfully uploading, just into the wrong directory.
  • Manual workaround works: If I manually create the 26 (todays date) folder via SSH/FTP, Cheverto successfully uploads the new images inside it without any issues.

Has anyone experienced this before? Is there a specific timeout setting or known bug with the FTP API failing to create directories while still successfully passing the file upload?

Any advice would be appreciated!

I saw that the similar bug was fixed with 4.5.3 (https://chevereto.com/community/thr...migrating-to-another-server.16368/#post-80055). But i am running on 4.5.7
 
I have fixed the issue by editing the below file


app/src/Legacy/Classes/Ftp.php


1. chdir() — lines 71–77

Find this
public function chdir(string $path): void
{
try {
ftp_chdir($this->ftp, $path);
} catch (Throwable $e) {
throw new Exception("Unable to change dir '{$path}'", 600, $e);
}
}

Replace with this:
public function chdir(string $path): void
{
if (@ftp_chdir($this->ftp, $path) !== true) {
throw new Exception("Unable to change dir '{$path}'", 600);
}
}

2. mkdirRecursive() — lines 130–160

Find this:
public function mkdirRecursive(string $path): void
{
$path = trim($path, '/');
$cwd = ftp_pwd($this->ftp);
if (! $cwd) {
throw new Exception("Can't get current working directory for " . $path, 600);
}
$cwd .= '/';
foreach (explode('/', $path) as $part) {
$cwd .= $part . '/';
if (empty($part)) {
continue;
}

try {
ftp_chdir($this->ftp, $cwd);
} catch (Throwable $e) {
try {
ftp_mkdir($this->ftp, $part);
} catch (Throwable $e) {
throw new Exception("Can't make recursive dir for " . $part, 600, $e);
}

try {
ftp_chdir($this->ftp, $part);
} catch (Throwable $e) {
throw new Exception('Unable to change fir to ' . $part, 600, $e);
}
}
}
}


Replace with this:

public function mkdirRecursive(string $path): void
{
$path = trim($path, '/');
foreach (explode('/', $path) as $part) {
if ($part === '') {
continue;
}
if (@ftp_chdir($this->ftp, $part) === true) {
continue;
}
if (@ftp_mkdir($this->ftp, $part) === false) {
throw new Exception("Can't make recursive dir for " . $part, 600);
}
if (@ftp_chdir($this->ftp, $part) !== true) {
throw new Exception('Unable to change dir to ' . $part, 600);
}
}
}


if editing the file is too much, then just replace the updated attached file
 

Attachments

Back
Top