Welcome Guest, Not a member yet? Register   Sign In
how to download a file use a valid code?
#1

[eluser]jeantoe[/eluser]
I began a small file download project like megaupload (for fun) recently.

megaupload link:
http://www.megaupload.com/?d=PABVSVJV

when i type a valid code i can get a link to download like:http://www599.megaupload.com/files/03b6eb2dfdd034f0c2e8e2aaa4cd931f/ubotryout.rar

can i use codeigniter to do like this ?

If someone knows how to do this or if someone could help me find the way to do this, please help me.

thank you.
#2

[eluser]pickupman[/eluser]
Yes with the exception you wouldn't have to use a query string. You will need to create an interface that allows users to create uploads. When they upload a file, add file data to the database. Dynamically create a link to the asset using a the file id (ie. http://yoursite.com/d/(some_number_here). Using routes.php add something like
Code:
$route['d/(:num)'] = 'files/$1';

Then create a files controller that can redirect to your long url from information from the DB using the file id that is passed to it.
#3

[eluser]jeantoe[/eluser]
[quote author="pickupman" date="1275258147"]Yes with the exception you wouldn't have to use a query string. You will need to create an interface that allows users to create uploads. When they upload a file, add file data to the database. Dynamically create a link to the asset using a the file id (ie. http://yoursite.com/d/(some_number_here). Using routes.php add something like
Code:
$route['d/(:num)'] = 'files/$1';

Then create a files controller that can redirect to your long url from information from the DB using the file id that is passed to it.[/quote]

thank you . how is the performance? when lots of users to download a big file?
#4

[eluser]pickupman[/eluser]
It all depends on your server, and your bandwidth available. You could use DB caching to lighten the load on the DB, but actual D/L speeds depends on what you've got available to you.
#5

[eluser]vitoco[/eluser]
i think that the performance issue it's not at the custom routes, but in serving the file to the user...so what's your server ?? apache or lighttpd ??

Saludos
#6

[eluser]jeantoe[/eluser]
[quote author="vitoco" date="1275362472"]i think that the performance issue it's not at the custom routes, but in serving the file to the user...so what's your server ?? apache or lighttpd ??

Saludos[/quote]


hi ! i plan to use nginx. how is lighttpd ? i've not used lighttpd .




Theme © iAndrew 2016 - Forum software by © MyBB