how to change default files location for download

07.06.2018 22:55
#1
k1aria
Joomshopping forum user no avatar
Name: keyvan
03.09.2017
Posts: 6
Quote
how to change default files location for download

hi
im using joomshopping for sell files in my website. i want to change my default files_products folder to another place in another server and in : components/com_jshopping/lib/default_config.php i changes this line:
$config->files_product_path = $config->path."files/files_products";

to :

$config->files_product_path = "http://example.com/files";

and in joomshopping product , in files section , i will set the name of zip file in (example.com/files) folder
example: test.zip

--> example.com/files/test.zip

but the download link after but files is empty . (only $config->path."files/files_products") will work and set any address with http not going to work (except local addresses in main server)

help me :(
thank you


Joomla: 3.7.5
JoomShopping: 4.10.5
PHP: 7.0.29
MySQL: 5.6.34
Website Url: www.programdan.ir
 
08.06.2018 08:09
#2
admin
(Support Team)
User admin
Name: Admin
05.08.2010
Posts: 21674
Quote
Aw: how to change default files location for download

TEST:
Change model/productdownload.php

public function downloadFile($file_name){
if (!file_exists($file_name)){
throw new Exception('Error. File not exist');
}
print $file_name;
print '-';
print filesize($file_name);
die();

$fp = fopen($file_name, "rb");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
header("Content-Type: application/octet-stream");
header("Content-Length: " . (string)(filesize($file_name)));
header('Content-Disposition: attachment; filename="' . basename($file_name) . '"');
header("Content-Transfer-Encoding: binary");

while( (!feof($fp)) && (connection_status()==0) ){
print(fread($fp, 1024*8));
flush();
}
fclose($fp);
}

click download.
?

 
08.06.2018 10:23
#3
k1aria
Joomshopping forum user no avatar
Name: keyvan
03.09.2017
Posts: 6
Quote
Aw: how to change default files location for download

i fixed it in : controller/product.php

but the download link is appear and any one can copy and use it. how can i hide or hash it??

 
08.06.2018 13:44
#4
admin
(Support Team)
User admin
Name: Admin
05.08.2010
Posts: 21674
Quote
Aw: how to change default files location for download

only for test.

result?

 
08.06.2018 14:08
#5
k1aria
Joomshopping forum user no avatar
Name: keyvan
03.09.2017
Posts: 6
Quote
Aw: how to change default files location for download

can i set ftp address with user and pass in default_config???

 
08.06.2018 16:46
#6
admin
(Support Team)
User admin
Name: Admin
05.08.2010
Posts: 21674
Quote
Aw: how to change default files location for download

No.

 
08.06.2018 17:14
#7
k1aria
Joomshopping forum user no avatar
Name: keyvan
03.09.2017
Posts: 6
Quote
Aw: how to change default files location for download

so how can i set another host address to sell files?? (with hashing download links) :(

 
08.06.2018 20:15
#8
admin
(Support Team)
User admin
Name: Admin
05.08.2010
Posts: 21674
Quote
Aw: how to change default files location for download

No possible (with hashing download links)
Need development for you.

possible only
Change url download - #1

$config->files_product_path = ...


Last change: 08.06.2018 20:18
 
08.06.2018 20:50
#9
k1aria
Joomshopping forum user no avatar
Name: keyvan
03.09.2017
Posts: 6
Quote
Aw: how to change default files location for download

oh ok.

what about this , can i make limit for downloads? for example just 2 time

 
08.06.2018 21:26
#10
admin
(Support Team)
User admin
Name: Admin
05.08.2010
Posts: 21674
Quote
Aw: how to change default files location for download

Configuration / other config

Max total of download sale file

 
08.06.2018 21:36
#11
k1aria
Joomshopping forum user no avatar
Name: keyvan
03.09.2017
Posts: 6
Quote
Aw: how to change default files location for download

this way just will work in same host

not in direct download link way

 
09.06.2018 07:29
#12
admin
(Support Team)
User admin
Name: Admin
05.08.2010
Posts: 21674
Quote
Aw: how to change default files location for download

chnage code
models/productdownload.php

public function downloadFile($file_name){
/*if (!file_exists($file_name)){
throw new Exception('Error. File not exist');
}*/

$fp = fopen($file_name, "rb");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
header("Content-Type: application/octet-stream");
//header("Content-Length: " . (string)(filesize($file_name)));
header('Content-Disposition: attachment; filename="' . basename($file_name) . '"');
header("Content-Transfer-Encoding: binary");

while( (!feof($fp)) && (connection_status()==0) ){
print(fread($fp, 1024*8));
flush();
}
fclose($fp);
}

 


Copyrights MAXXmarketing GmbH. Alle Rechte vorbehalten
Durch die Nutzung dieser Website stimme ich zu, dass Cookies zur optimalen Gestaltung der Website sowie zur Analyse der Nutzung der Website verwendet werden. Weiterführende Informationen finden Sie hier. OK, einverstanden.