Extension Installer opencart 2 file not upload

Extension Installer opencart 2 file not upload

OpenCart 2.0 is out and there are a couple of things that need a little help to work as intended. For instance If you get an error below saying “Could not connect as ……” while uploading your zipped extensions via the Extension Installer, you probably have the FTP support disabled from your hosting. We will offer two ways to solve this – one for tech-savvy people who are comfortable with editing files on their FTP and one for store owners who can run it via the OC Installer.

maxresdefault

1. Here is how to fix this? (Store owner version, set up in less than 30 seconds)

As an alternative you can just download this OCMOD ready modification file, which we contributed to the OpenCart society and just follow the installation instructions : http://www.opencart.com/index.php?route=extension/extension/info&extension_id=18892

2. Here is how to fix this? (Developer version)

Open up Notepad++, Dreaweaver or any other editor and go to admin/controller/extension/installer.php and before the line saying:

1public function unzip() {

paste the following code

01public function localcopy() {
02        $this->load->language('extension/installer');
03
04        $json = array();
05
06        if (!$this->user->hasPermission('modify', 'extension/installer')) {
07            $json['error'] = $this->language->get('error_permission');
08        }
09
10        $directory = DIR_DOWNLOAD . str_replace(array('../', '..\', '..'), '', $this->request->post['path']) . '/upload/';
11
12        if (!is_dir($directory)) {
13            $json['error'] = $this->language->get('error_directory');
14        }
15
16        if (!$json) {
17            // Get a list of files ready to upload
18            $files = array();
19
20            $path = array($directory . '*');
21
22            while (count($path) != 0) {
23                $next = array_shift($path);
24
25                foreach (glob($next) as $file) {
26                    if (is_dir($file)) {
27                        $path[] = $file . '/*';
28                    }
29
30                    $files[] = $file;
31                }
32            }
33
34            $root = dirname(DIR_APPLICATION).'/';
35
36            foreach ($files as $file) {
37                // Upload everything in the upload directory
38                $destination = $root.substr($file, strlen($directory));
39
40                if (is_dir($file)) {
41                    $list = glob(rtrim($destination, '/').'/*');
42
43                    if (!file_exists($destination)) {
44                        if (!mkdir($destination)) {
45                            $json['error'] = sprintf($this->language->get('error_ftp_directory'), $destination);
46                        }
47                    }
48                }
49
50                if (is_file($file)) {
51                    if (!copy($file, $destination)) {
52                        $json['error'] = sprintf($this->language->get('error_ftp_file'), $file);
53                    }
54                }
55            }
56        }
57
58        $this->response->addHeader('Content-Type: application/json');
59        $this->response->setOutput(json_encode($json));
60    }

Then find this line:

1'url'  => str_replace('&', '&', $this->url->link('extension/installer/ftp', 'token=' . $this->session->data['token'], 'SSL')),

and change it with:

1'url'  => str_replace('&', '&', $this->url->link('extension/installer/localcopy', 'token=' . $this->session->data['token'], 'SSL')),

 

That’s it, you can now enjoy the module installer! Sharing is caring so spread the word. Thanks!

Leave a comment