Post by Busyhand » Mon Nov 13, 2017 6:00 pm

Hi,
Can someone please help me!!

I am having problems with image manager on my new opencart 3.0.2.0 I keep getting the warning directory does not exist

I have been through all the forums possible and tried everything possible to fix but am getting know where. I have changed the permissions to 775 and 777 on the image file and catalog but still no go. I have also checked the config file for the path and it all looks ok.

I am quite a novice at all this so if someone could tell me how to fix in straight forward language I would be most grateful.
Andrew

Newbie

Posts

Joined
Sun Nov 12, 2017 6:57 pm

Post by straightlight » Tue Nov 14, 2017 12:10 am

Follow these instructions and see if that resolves the issue: viewtopic.php?f=199&t=199580 . Also check your access logs from your FTP or from your host console after following these steps noticing if new lines are appearing when attempting to use the File Manager.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by Busyhand » Wed Nov 15, 2017 5:10 am

Hi Straightlight,

I have gone to that link and it has nothing to do with the issues I'm having with image manager and directory does not exist!

Can anyone else help me please?
Andrew

Newbie

Posts

Joined
Sun Nov 12, 2017 6:57 pm

Post by straightlight » Wed Nov 15, 2017 5:37 am

I don't know the browser pastes the wrong topic but anyways. Followed are the links you can try:

- https://github.com/opencart/opencart/bl ... anager.php
- https://github.com/opencart/opencart/bl ... nager.twig

Clear all caches after. Good luck

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by Ankit11188 » Fri May 01, 2020 8:25 pm

I've tried replacing above said files -
>>>opencart/upload/admin/view/template/common/filemanager.twig
>>>opencart/upload/admin/controller/common/filemanager.php
also my config.php files are having correct images path.

Image Manager is saying "Warning: Directory does not exist!", refer to attachment screenshots, there is no any image visible on website storefront, whereas website LOGO is the only image visible on default template of opencart Version 3.0.3.2. All this happened after i upgraded from opencart 1.5.6.4.

Is there any way how this can be resolve i've tried a lot.
Refer to 3 screenshot attachments.

Attachments

Screenshot (429).png

Image Upload is showing plain box. - Screenshot (429).png (48.51 KiB) Viewed 3395 times

Screenshot (428).png

Image Upload is showing plain box. - Screenshot (428).png (50.97 KiB) Viewed 3395 times

Screenshot (425).png

Warning: Directory does not exist! - Screenshot (425).png (51.21 KiB) Viewed 3395 times


Newbie

Posts

Joined
Tue Nov 19, 2019 3:58 pm

Post by straightlight » Fri May 01, 2020 9:11 pm

Did you cleared your OC cache after replacing those files by following this FAQ: viewtopic.php?f=134&t=215776#p718325

Please post your config.php and admin/config.php files without password information.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by Ankit11188 » Sat May 02, 2020 1:30 am

Hi,
Yes i've cleared OC cache, then also issue is the same.
I've provided files, please take a look.
----------------------------config.php--------------------------------------

Code: Select all

<?php
// HTTP
define('HTTP_SERVER', 'http://techdeli.com/');

// HTTPS
define('HTTPS_SERVER', 'http://techdeli.com/');

// DIR
define('DIR_APPLICATION', '/home/techdeli/public_html/catalog/');
define('DIR_SYSTEM', '/home/techdeli/public_html/system/');
define('DIR_DATABASE', '/home/techdeli/public_html/system/database/');
define('DIR_LANGUAGE', '/home/techdeli/public_html/catalog/language/');
define('DIR_TEMPLATE', '/home/techdeli/public_html/catalog/view/theme/');
define('DIR_CONFIG', '/home/techdeli/public_html/system/config/');
define('DIR_IMAGE', '/home/techdeli/public_html/image/');
define('DIR_STORAGE', '/home/techdeli/storage/');
define('DIR_CACHE', DIR_STORAGE . 'cache/');
define('DIR_DOWNLOAD', DIR_STORAGE . 'download/');
define('DIR_MODIFICATION', DIR_STORAGE . 'modification/');
define('DIR_SESSION', DIR_STORAGE . 'session/');
define('DIR_UPLOAD', DIR_STORAGE . 'upload/');
define('DIR_LOGS', DIR_STORAGE . 'logs/');
----------------------------admin/config.php--------------------------------------

Code: Select all

<?php
// HTTP
define('HTTP_SERVER', 'http://techdeli.com/admin/');
define('HTTP_CATALOG', 'http://techdeli.com/');

// HTTPS
define('HTTPS_SERVER', 'http://techdeli.com/admin/');
define('HTTPS_CATALOG', 'http://techdeli.com/');

// DIR
define('DIR_APPLICATION', '/home/techdeli/public_html/admin/');
define('DIR_SYSTEM', '/home/techdeli/public_html/system/');
define('DIR_DATABASE', '/home/techdeli/public_html/system/database/');
define('DIR_LANGUAGE', '/home/techdeli/public_html/admin/language/');
define('DIR_TEMPLATE', '/home/techdeli/public_html/admin/view/template/');
define('DIR_CONFIG', '/home/techdeli/public_html/system/config/');
define('DIR_IMAGE', '/home/techdeli/public_html/image/');
define('DIR_STORAGE', '/home/techdeli/storage/');
define('DIR_STORAGE', '/home/techdeli/storage/');
define('DIR_CACHE', DIR_STORAGE . 'cache/');
define('DIR_DOWNLOAD', DIR_STORAGE . 'download/');
define('DIR_MODIFICATION', DIR_STORAGE . 'modification/');
define('DIR_SESSION', DIR_STORAGE . 'session/');
define('DIR_UPLOAD', DIR_STORAGE . 'upload/');
define('DIR_LOGS', DIR_STORAGE . 'logs/');
define('DIR_CATALOG', '/home/techdeli/public_html/catalog/');
------------------------------------------------
Last edited by straightlight on Sat May 02, 2020 2:23 am, edited 1 time in total.
Reason: Added code tags.

Newbie

Posts

Joined
Tue Nov 19, 2019 3:58 pm

Post by straightlight » Sat May 02, 2020 2:26 am

Ok. Now, please post your .htaccess file with code tags.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by Ankit11188 » Sat May 02, 2020 4:56 pm

----------------.htaccess.txt --------------------

Code: Select all

# 1.To use URL Alias you need to be running apache with mod_rewrite enabled.

# 2. In your opencart directory rename htaccess.txt to .htaccess.

# For any support issues please visit: http://www.opencart.com

Options +FollowSymlinks

# Prevent Directoy listing
Options -Indexes

# Prevent Direct Access to files
<FilesMatch "(?i)((\.tpl|.twig|\.ini|\.log|(?<!robots)\.txt))">
 Require all denied
## For apache 2.2 and older, replace "Require all denied" with these two lines :
# Order deny,allow
# Deny from all
</FilesMatch>

# SEO URL Settings
RewriteEngine On
# If your opencart installation does not run on the main web folder make sure you folder it does run in ie. / becomes /shop/

RewriteBase /
RewriteRule ^sitemap.xml$ index.php?route=extension/feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=extension/feed/google_base [L]
RewriteRule ^system/storage/(.*) index.php?route=error/not_found [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]

### Additional Settings that may need to be enabled for some servers
### Uncomment the commands by removing the # sign in front of it.
### If you get an "Internal Server Error 500" after enabling any of the following settings, restore the # as this means your host doesn't allow that.

# 1. If your cart only allows you to add one item at a time, it is possible register_globals is on. This may work to disable it:
# php_flag register_globals off

# 2. If your cart has magic quotes enabled, This may work to disable it:
# php_flag magic_quotes_gpc Off

# 3. Set max upload file size. Most hosts will limit this and not allow it to be overridden but you can try
# php_value upload_max_filesize 999M

# 4. set max post size. uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
# php_value post_max_size 999M

# 5. set max time script can take. uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
# php_value max_execution_time 200

# 6. set max time for input to be recieved. Uncomment this line if you have a lot of product options or are getting errors where forms are not saving all fields
# php_value max_input_time 200

# 7. disable open_basedir limitations
# php_admin_value open_basedir none
Last edited by straightlight on Sat May 02, 2020 5:04 pm, edited 1 time in total.
Reason: Added code tags.

Newbie

Posts

Joined
Tue Nov 19, 2019 3:58 pm

Post by letxobnav » Sat May 02, 2020 5:18 pm

admin/controller/common/filemanager.php

put these

Code: Select all

$this->log->write('filemanager upload');
$this->log->write('this needs to be a valid directory: '.$directory);
$this->log->write('this: '.substr(str_replace('\\', '/', realpath($directory)), 0, strlen(DIR_IMAGE . 'catalog')));
$this->log->write('needs to equal this: '.str_replace('\\', '/', DIR_IMAGE . 'catalog'));
right after

Code: Select all

		// Check its a directory
in function upload()

then you can see in your OC error log why it believes it is not a valid directory.
realpath tends to give different results on different installations.

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by Ankit11188 » Sat May 02, 2020 6:49 pm

Hi, thanks for response, i've received this inside error log, but don't know how to proceed, i need guidance. Below stated are error logs -

Code: Select all

2020-05-02 10:26:26 - filemanager upload
2020-05-02 10:26:26 - this needs to be a valid directory: /home/techdeli/public_html/image/catalog
2020-05-02 10:26:26 - this: /home/techdeli/domains/techdeli.com/
2020-05-02 10:26:26 - needs to equal this: /home/techdeli/public_html/image/catalog
2020-05-02 10:29:54 - filemanager upload
2020-05-02 10:29:54 - this needs to be a valid directory: /home/techdeli/public_html/image/catalog
2020-05-02 10:29:54 - this: /home/techdeli/domains/techdeli.com/
2020-05-02 10:29:54 - needs to equal this: /home/techdeli/public_html/image/catalog
Later on when this didn't worked i also tried modifying DIR inside config.php and admin/config.php
define('DIR_IMAGE', '/home/techdeli/public_html/image/catalog');
This also did'nt worked.
:'(
Last edited by Ankit11188 on Sun May 03, 2020 1:05 am, edited 3 times in total.

Newbie

Posts

Joined
Tue Nov 19, 2019 3:58 pm

Post by straightlight » Sat May 02, 2020 7:31 pm

Ensure your root image/catalog folder does exist. If so, then ensure the install.txt documentation file has been followed regarding folder permissions which can be found in the downloaded ZIP file from opencart.com prior on installing Opencart.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by letxobnav » Sat May 02, 2020 8:22 pm

your host uses symbolic links to map
/home/techdeli/public_html/
to probably
/home/techdeli/domains/techdelivers.com/

The function realpath() returns the canonicalized absolute pathname stripped of any symbolic links, i.e. the actual physical path the symbolic link points to.
So when OC compares the two, they will not match, why they are compared to determine if it is a valid directory is beyond me, just checking if realpath returns true is enough to determine if the actual directory exists for that symbolic link.

I would simply remove the additional check and just leave

Code: Select all

if (!is_dir($directory)) {

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by Ankit11188 » Sun May 03, 2020 1:06 am

Nothing worked.

Newbie

Posts

Joined
Tue Nov 19, 2019 3:58 pm

Post by straightlight » Sun May 03, 2020 1:59 am

Ankit11188 wrote:
Sun May 03, 2020 1:06 am
Nothing worked.
I understand the frustration that this situation may cause. However, please do not to use constant caps on the forum.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by letxobnav » Sun May 03, 2020 9:41 am

admin/controller/common/filemanager.php

line 39

Code: Select all

		if (substr(str_replace('\\', '/', realpath($directory) . '/' . $filter_name), 0, strlen(DIR_IMAGE . 'catalog')) == str_replace('\\', '/', DIR_IMAGE . 'catalog')) {
change to

Code: Select all

		if ( 1 || substr(str_replace('\\', '/', realpath($directory) . '/' . $filter_name), 0, strlen(DIR_IMAGE . 'catalog')) == str_replace('\\', '/', DIR_IMAGE . 'catalog')) {
line 209 ( you did already? )

Code: Select all

		if (!is_dir($directory) || substr(str_replace('\\', '/', realpath($directory)), 0, strlen(DIR_IMAGE . 'catalog')) != str_replace('\\', '/', DIR_IMAGE . 'catalog')) {
change to

Code: Select all

		if (!is_dir($directory)) {
line 304

Code: Select all

		if (!is_dir($directory) || substr(str_replace('\\', '/', realpath($directory)), 0, strlen(DIR_IMAGE . 'catalog')) != str_replace('\\', '/', DIR_IMAGE . 'catalog')) {
change to

Code: Select all

		if (!is_dir($directory)) {
line 355

Code: Select all

			if ($path == DIR_IMAGE . 'catalog' || substr(str_replace('\\', '/', realpath(DIR_IMAGE . $path)), 0, strlen(DIR_IMAGE . 'catalog')) != str_replace('\\', '/', DIR_IMAGE . 'catalog')) {
change to

Code: Select all

			if ($path == DIR_IMAGE . 'catalog') {

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by Li-on » Sun Nov 06, 2022 8:25 pm

Hello!
I want to say THANK YOU as these changes helped me fix my file manager. :)

Newbie

Posts

Joined
Sun Nov 06, 2022 8:23 pm
Who is online

Users browsing this forum: No registered users and 135 guests