XFileSharing Pro - generate download link with deffrent port website

Message
Author
sherayusuf3
Posts: 94
Joined: Jan 18, 2009 4:29 am

generate download link with deffrent port website

#1 Postby sherayusuf3 » Nov 15, 2009 10:23 am

hello,

im already search this forum not found same with my case

1. how to create diffrent port when generate download lin
example :
when people click download file, the link format is or after upload file :
http://site.com/1h2b34j24j2/name-file.zip
how to costumize adding port after site.com like
http://site.com:8000/1h2b34j24j2/name-file.zip

2. how to adding site url on file when user upload
example :
origin file name is : name-file.zip
after upload n when user download file rename with site url like site.com_name-file.zip


thnks

sherayusuf3
Posts: 94
Joined: Jan 18, 2009 4:29 am

Re: generate download link with deffrent port website

#2 Postby sherayusuf3 » Nov 18, 2009 4:20 am

up up up

User avatar
PilgrimX182
Posts: 2186
Joined: Mar 22, 2006 1:39 pm

#3 Postby PilgrimX182 » Nov 18, 2009 2:24 pm

In index.cgi replace

Code: Select all

return "$file->{srv_htdocs_url}/$ddcode/$fname";
with

Code: Select all

return "$file->{srv_htdocs_url}:8080/$ddcode/$fname";
where 8080 - your port.
Should do the trick.

sherayusuf3
Posts: 94
Joined: Jan 18, 2009 4:29 am

#4 Postby sherayusuf3 » Nov 19, 2009 2:24 am

PilgrimX182 wrote:In index.cgi replace

Code: Select all

return "$file->{srv_htdocs_url}/$ddcode/$fname";
with

Code: Select all

return "$file->{srv_htdocs_url}:8080/$ddcode/$fname";
where 8080 - your port.
Should do the trick.

not work :D
http://site.com/files:8000/1/h2b34j24j2/name-file.zip

missup
Posts: 9
Joined: Oct 30, 2009 12:53 am

#5 Postby missup » Nov 27, 2009 8:32 am

anyone success with it?

naga
Posts: 45
Joined: Dec 22, 2008 3:40 pm

#6 Postby naga » Nov 27, 2009 11:39 am

It did not work because you have the htdocs_url as ...files

what you can do is either just add the htdocs url in the fileserver edit menu as :8000 and leave the cgi bin on the normal poort, or try this modification I use for having premium users download from a different poort and htdocs url.

in index.cgi find

Code: Select all

$file->{direct_link} = "$file->{srv_htdocs_url}/$ddcode/$file->{file_name}";
change to;

Code: Select all

	if($file->{srv_htdocs_url} eq "http://fileserver20.something.com/files")
	{
		$file->{direct_link} = "http://fileserver20.something.com:8000/files/$ddcode/$file->{file_name}";
	}
else
{
$file->{direct_link} = "$file->{srv_htdocs_url}/$ddcode/$file->{file_name}";
}
downside is that you have to put in elsif's for every fileserver you want a different port or path to files for...

Also to do different stuff for premium users you can use

Code: Select all

if($premium)
{

Hope this helps...

missup
Posts: 9
Joined: Oct 30, 2009 12:53 am

#7 Postby missup » Nov 27, 2009 3:54 pm

thanks naga! will try it when get back home!

missup
Posts: 9
Joined: Oct 30, 2009 12:53 am

#8 Postby missup » Nov 27, 2009 4:02 pm

oh just crossed my mind, how if i have many servers ? like
if {serverhostname} then goes to serverhostname:8000

anyway as i remember there is no htdocs_url config in fileserver

sherayusuf3
Posts: 94
Joined: Jan 18, 2009 4:29 am

#9 Postby sherayusuf3 » Apr 18, 2010 3:01 am

Thnks Naga, how about multiple server?
how to define

naga
Posts: 45
Joined: Dec 22, 2008 3:40 pm

#10 Postby naga » Apr 21, 2010 10:35 pm

sherayusuf3 wrote:Thnks Naga, how about multiple server?
how to define
I have done it using else-if statements

Code: Select all

   if($file->{srv_htdocs_url} eq "http://fileserver20.something.com/files")
   {
      $file->{direct_link} = "http://fileserver20.something.com:8000/files/$ddcode/$file->{file_name}";
   }
elsif($file->{srv_htdocs_url} eq "http://fileserver21.something.com/files")
   {
      $file->{direct_link} = "http://fileserver21.something.com:8000/files/$ddcode/$file->{file_name}";
   }
else
{
$file->{direct_link} = "$file->{srv_htdocs_url}/$ddcode/$file->{file_name}";
}
you can use as many elsif's as you like, but with 30 elsif's I wouldnt recommend it