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.

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:
1 |
public function unzip() { |
paste the following code
01 |
public function localcopy() { |
02 |
$this ->load->language( 'extension/installer' ); |
06 |
if (! $this ->user->hasPermission( 'modify' , 'extension/installer' )) { |
07 |
$json [ 'error' ] = $this ->language->get( 'error_permission' ); |
10 |
$directory = DIR_DOWNLOAD . str_replace ( array ( '../' , '..\' , '..' ), '' , $this ->request->post[ 'path' ]) . '/upload/' ; |
12 |
if (! is_dir ( $directory )) { |
13 |
$json [ 'error' ] = $this ->language->get( 'error_directory' ); |
20 |
$path = array ( $directory . '*' ); |
22 |
while ( count ( $path ) != 0) { |
23 |
$next = array_shift ( $path ); |
25 |
foreach ( glob ( $next ) as $file ) { |
27 |
$path [] = $file . '/*' ; |
34 |
$root = dirname(DIR_APPLICATION). '/' ; |
36 |
foreach ( $files as $file ) { |
38 |
$destination = $root . substr ( $file , strlen ( $directory )); |
41 |
$list = glob (rtrim( $destination , '/' ). '/*' ); |
43 |
if (! file_exists ( $destination )) { |
44 |
if (! mkdir ( $destination )) { |
45 |
$json [ 'error' ] = sprintf( $this ->language->get( 'error_ftp_directory' ), $destination ); |
51 |
if (! copy ( $file , $destination )) { |
52 |
$json [ 'error' ] = sprintf( $this ->language->get( 'error_ftp_file' ), $file ); |
58 |
$this ->response->addHeader( 'Content-Type: application/json' ); |
59 |
$this ->response->setOutput(json_encode( $json )); |
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!