English Hello to everyone my name is eresbos, - How to create a limit file downloading with php? Türkçe Merhaba arkadaşlar ben eresbos.Bugün sizlere php ile dosya indirme işlemlerinde indirme hızı limiti nasıl konulur onu göstereceğim. - Kodlarımız ; ``` <?php $yerel_dosya = "deneme.zip"; $indirilecek_dosya = "indirilendosya.zip"; $indirme_hizi = 30; if(file_exists($yerel_dosya) && is_file($yerel_dosya)) { header("Content-Type: application/octet-stream"); header("Content-Length: ".filesize($yerel_dosya)); header("Content-Disposition: attachment; filename=" .$indirilecek_dosya); flush(); $dosya = fopen($yerel_dosya, "r"); while(!feof($dosya)) { print fread($dosya, round($indirme_hizi * 1024) ); flush(); sleep(1); } fclose($dosya); }else { echo 'Dosya mevcut degil'; } ?> ```  1- Projemiz için bir tane dosyaya ihtiyacımız var ben 4.36 mb boyutunda deneme.zip olarak oluşturdum ve localhosta attım.Sizde istediğiniz boyutta ve istediğiniz isimde dosya oluşturup localhosta atabilirsiniz.  2- Değişkenlerimizi tanımlayalım; - ```$yerel_dosya = "deneme.zip"``` değişkeni localhostta bulunan dosyamızı tanıtmaya yarıyor.  - ```$indirilecek_dosya = "indirilendosya.zip"``` dosyamızın indirme işlemi tamamlandığınca alacağı ismi tanıtmamızı sağlıyor.  - ```$indirme_hizi = 30;``` indirme limitimizi belirlememizi sağlıyor.Yani saniyede maksimum 30 kilobyte indirmemizi sağlayacak.  3- Dosya kontrolümüzü yapıyoruz.'Eğer dosyamız varsa ve bu klasör değilse' şeklinde koşulumuzu yazıyoruz. ``` if(file_exists($yerel_dosya) && is_file($yerel_dosya)) { ```  4- İndirme işlemini gerçekleştirmek için; - ```header("Content-Type: application/octet-stream");``` burada indirilecek dosyamızın tipini zip olarak belirliyoruz. - ```header("Content-Length: ".filesize($yerel_dosya));``` burada indirelecek dosyamızın boyutunu belirliyoruz. - ```header("Content-Disposition: attachment; filename=" .$indirilecek_dosya);``` burada indirme işlemimizi başlatmak ve indirirken hangi ismi kullanacağımızı belirlemek için yeni bir header yazıyoruz. ``` header("Content-Type: application/octet-stream"); header("Content-Length: ".filesize($yerel_dosya)); header("Content-Disposition: attachment; filename=" .$indirilecek_dosya); ```  5- ```flush();``` tarayıcıya gömme işlemimizi yapıyoruz.  6- ```$dosya = fopen($yerel_dosya, "r");``` dosyamızı açıp parça parça okutma işlemini gerçekleştiriyoruz.  7- ```while(!feof($dosya)) {``` while döngümüzü kuruyoruz, dosyanın sonuna kadar okunup okunmadığını kontrol ediyoruz.  8- ```print fread($dosya, round($indirme_hizi * 1024) );``` dosyamızı okuttuktan sonra 1024 ile çarpıp kilobyte değerini ekrana yazdırıyoruz.  9- Tekrar ```flush();``` methoduyla tarayıcımıza gömüyoruz.  10- ```sleep(1);``` sleep ile 1 saniye bekleme süresi koyuyoruz.  11- ```fclose($dosya);``` burada indirme işlemini tamamladıktan sonra fclose ile açtığımız dosyayı kapatıyoruz.  12- ```}else {``` eğer üçüncü adımda yazdığımız koşul sağlanmıyorsa,  13- ```echo 'Dosya mevcut degil';``` ekrana dosya mevcut değil sonucunu bastırıyoruz. Github link : https://github.com/php/php-src <br /><hr/><em>Posted on <a href="https://utopian.io/utopian-io/@eresbos/php-ile-dosya-indirme-islemini-limitlendirme-turkish-tutorial">Utopian.io - Rewarding Open Source Contributors</a></em><hr/>
author | eresbos | ||||||
---|---|---|---|---|---|---|---|
permlink | php-ile-dosya-indirme-islemini-limitlendirme-turkish-tutorial | ||||||
category | utopian-io | ||||||
json_metadata | "{"community":"utopian","app":"utopian/1.0.0","format":"markdown","repository":{"id":1903522,"name":"php-src","full_name":"php/php-src","owner":{"login":"php","id":25158,"avatar_url":"https://avatars2.githubusercontent.com/u/25158?v=4","gravatar_id":"","url":"https://api.github.com/users/php","html_url":"https://github.com/php","followers_url":"https://api.github.com/users/php/followers","following_url":"https://api.github.com/users/php/following{/other_user}","gists_url":"https://api.github.com/users/php/gists{/gist_id}","starred_url":"https://api.github.com/users/php/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/php/subscriptions","organizations_url":"https://api.github.com/users/php/orgs","repos_url":"https://api.github.com/users/php/repos","events_url":"https://api.github.com/users/php/events{/privacy}","received_events_url":"https://api.github.com/users/php/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/php/php-src","description":"The PHP Interpreter","fork":false,"url":"https://api.github.com/repos/php/php-src","forks_url":"https://api.github.com/repos/php/php-src/forks","keys_url":"https://api.github.com/repos/php/php-src/keys{/key_id}","collaborators_url":"https://api.github.com/repos/php/php-src/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/php/php-src/teams","hooks_url":"https://api.github.com/repos/php/php-src/hooks","issue_events_url":"https://api.github.com/repos/php/php-src/issues/events{/number}","events_url":"https://api.github.com/repos/php/php-src/events","assignees_url":"https://api.github.com/repos/php/php-src/assignees{/user}","branches_url":"https://api.github.com/repos/php/php-src/branches{/branch}","tags_url":"https://api.github.com/repos/php/php-src/tags","blobs_url":"https://api.github.com/repos/php/php-src/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/php/php-src/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/php/php-src/git/refs{/sha}","trees_url":"https://api.github.com/repos/php/php-src/git/trees{/sha}","statuses_url":"https://api.github.com/repos/php/php-src/statuses/{sha}","languages_url":"https://api.github.com/repos/php/php-src/languages","stargazers_url":"https://api.github.com/repos/php/php-src/stargazers","contributors_url":"https://api.github.com/repos/php/php-src/contributors","subscribers_url":"https://api.github.com/repos/php/php-src/subscribers","subscription_url":"https://api.github.com/repos/php/php-src/subscription","commits_url":"https://api.github.com/repos/php/php-src/commits{/sha}","git_commits_url":"https://api.github.com/repos/php/php-src/git/commits{/sha}","comments_url":"https://api.github.com/repos/php/php-src/comments{/number}","issue_comment_url":"https://api.github.com/repos/php/php-src/issues/comments{/number}","contents_url":"https://api.github.com/repos/php/php-src/contents/{+path}","compare_url":"https://api.github.com/repos/php/php-src/compare/{base}...{head}","merges_url":"https://api.github.com/repos/php/php-src/merges","archive_url":"https://api.github.com/repos/php/php-src/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/php/php-src/downloads","issues_url":"https://api.github.com/repos/php/php-src/issues{/number}","pulls_url":"https://api.github.com/repos/php/php-src/pulls{/number}","milestones_url":"https://api.github.com/repos/php/php-src/milestones{/number}","notifications_url":"https://api.github.com/repos/php/php-src/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/php/php-src/labels{/name}","releases_url":"https://api.github.com/repos/php/php-src/releases{/id}","deployments_url":"https://api.github.com/repos/php/php-src/deployments","created_at":"2011-06-16T01:52:25Z","updated_at":"2017-12-31T12:57:25Z","pushed_at":"2017-12-31T12:04:09Z","git_url":"git://github.com/php/php-src.git","ssh_url":"git@github.com:php/php-src.git","clone_url":"https://github.com/php/php-src.git","svn_url":"https://github.com/php/php-src","homepage":"http://www.php.net","size":305504,"stargazers_count":14041,"watchers_count":14041,"language":"C","has_issues":false,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":4565,"mirror_url":null,"archived":false,"open_issues_count":133,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":4565,"open_issues":133,"watchers":14041,"default_branch":"master","score":149.17505},"pullRequests":[],"platform":"github","type":"tutorials","tags":["utopian-io","utopian-io","tr"],"links":["https://res.cloudinary.com/hpiynhbhq/image/upload/v1514855555/gtocghekqoxp9hsqbjaz.png","https://res.cloudinary.com/hpiynhbhq/image/upload/v1514852733/xybbrzuqtu33kn03kjbh.png","https://res.cloudinary.com/hpiynhbhq/image/upload/v1514853228/ajceimwhlmpu6630dya4.png","https://res.cloudinary.com/hpiynhbhq/image/upload/v1514853253/tes2nxfdsdl3cjlg3m8e.png","https://res.cloudinary.com/hpiynhbhq/image/upload/v1514853364/dbqp0whjxfyzwf6rjbrn.png","https://res.cloudinary.com/hpiynhbhq/image/upload/v1514853663/hp1cyubr11usfghexkim.png","https://res.cloudinary.com/hpiynhbhq/image/upload/v1514854168/hjgvznnh8xobx7jpku4d.png","https://res.cloudinary.com/hpiynhbhq/image/upload/v1514854349/vqg1szyqngcfrkr1duyc.png","https://res.cloudinary.com/hpiynhbhq/image/upload/v1514854524/v6qylorgdvtovabe9azy.png","https://res.cloudinary.com/hpiynhbhq/image/upload/v1514854679/f9zf2oba20e05yb1wjim.png","https://res.cloudinary.com/hpiynhbhq/image/upload/v1514854845/gdetatljfd1mjdxqzcik.png","https://res.cloudinary.com/hpiynhbhq/image/upload/v1514854940/e04kubvxm3relyjm6rhu.png","https://res.cloudinary.com/hpiynhbhq/image/upload/v1514855004/lzocnyw00el7bwzeytof.png","https://res.cloudinary.com/hpiynhbhq/image/upload/v1514855090/czfhxgyoru9b0b9bgmve.png","https://res.cloudinary.com/hpiynhbhq/image/upload/v1514855167/qmeywlnlqas8dbvufir0.png"],"image":["https://res.cloudinary.com/hpiynhbhq/image/upload/v1514855555/gtocghekqoxp9hsqbjaz.png","https://res.cloudinary.com/hpiynhbhq/image/upload/v1514852733/xybbrzuqtu33kn03kjbh.png","https://res.cloudinary.com/hpiynhbhq/image/upload/v1514853228/ajceimwhlmpu6630dya4.png","https://res.cloudinary.com/hpiynhbhq/image/upload/v1514853253/tes2nxfdsdl3cjlg3m8e.png","https://res.cloudinary.com/hpiynhbhq/image/upload/v1514853364/dbqp0whjxfyzwf6rjbrn.png","https://res.cloudinary.com/hpiynhbhq/image/upload/v1514853663/hp1cyubr11usfghexkim.png","https://res.cloudinary.com/hpiynhbhq/image/upload/v1514854168/hjgvznnh8xobx7jpku4d.png","https://res.cloudinary.com/hpiynhbhq/image/upload/v1514854349/vqg1szyqngcfrkr1duyc.png","https://res.cloudinary.com/hpiynhbhq/image/upload/v1514854524/v6qylorgdvtovabe9azy.png","https://res.cloudinary.com/hpiynhbhq/image/upload/v1514854679/f9zf2oba20e05yb1wjim.png","https://res.cloudinary.com/hpiynhbhq/image/upload/v1514854845/gdetatljfd1mjdxqzcik.png","https://res.cloudinary.com/hpiynhbhq/image/upload/v1514854940/e04kubvxm3relyjm6rhu.png","https://res.cloudinary.com/hpiynhbhq/image/upload/v1514855004/lzocnyw00el7bwzeytof.png","https://res.cloudinary.com/hpiynhbhq/image/upload/v1514855090/czfhxgyoru9b0b9bgmve.png","https://res.cloudinary.com/hpiynhbhq/image/upload/v1514855167/qmeywlnlqas8dbvufir0.png"],"moderator":{"account":"sedatyildiz","reviewed":true,"pending":false,"flagged":false}}" | ||||||
created | 2018-01-02 01:13:21 | ||||||
last_update | 2018-01-06 22:20:33 | ||||||
depth | 0 | ||||||
children | 2 | ||||||
last_payout | 2018-01-09 01:13:21 | ||||||
cashout_time | 1969-12-31 23:59:59 | ||||||
total_payout_value | 21.271 HBD | ||||||
curator_payout_value | 9.137 HBD | ||||||
pending_payout_value | 0.000 HBD | ||||||
promoted | 0.000 HBD | ||||||
body_length | 4,904 | ||||||
author_reputation | 389,195,925,318 | ||||||
root_title | "php ile dosya indirme işlemini limitlendirme (turkish tutorial)" | ||||||
beneficiaries |
| ||||||
max_accepted_payout | 1,000,000.000 HBD | ||||||
percent_hbd | 10,000 | ||||||
post_id | 26,463,222 | ||||||
net_rshares | 3,116,497,506,608 | ||||||
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
nanokat | 0 | 418,104,800 | 100% | ||
logoped | 0 | 415,030,500 | 100% | ||
ribalko26 | 0 | 415,030,500 | 100% | ||
buynichenko | 0 | 402,733,300 | 100% | ||
bushkov | 0 | 391,111,222 | 100% | ||
evsyucko | 0 | 405,158,805 | 100% | ||
kirill.shulko | 0 | 418,573,079 | 100% | ||
svesenet | 0 | 395,994,367 | 100% | ||
kubr | 0 | 399,659,000 | 100% | ||
eslavnash | 0 | 406,111,200 | 100% | ||
leichenvera | 0 | 409,187,800 | 100% | ||
balalayka | 0 | 406,111,200 | 100% | ||
dennyse | 0 | 392,561,236 | 100% | ||
pushkinant | 0 | 421,494,200 | 100% | ||
zurrovani | 0 | 393,804,800 | 100% | ||
livochkin | 0 | 399,958,000 | 100% | ||
gddg42 | 0 | 384,575,000 | 100% | ||
sinankarayaman | 0 | 2,379,833,362 | 100% | ||
irisarma | 0 | 387,361,800 | 100% | ||
korosten | 0 | 403,034,600 | 100% | ||
dayjee | 0 | 13,964,733,864 | 100% | ||
irina00 | 0 | 390,436,100 | 100% | ||
mutov | 0 | 417,120,068 | 100% | ||
deerty | 0 | 399,087,904 | 100% | ||
utopian-io | 0 | 3,087,330,627,702 | 1.81% | ||
odl | 0 | 2,382,008,819 | 100% | ||
itrioilamoricle | 0 | 407,568,870 | 100% | ||
javatorman | 0 | 1,160,494,510 | 100% |
Thank you for the contribution. It has been approved. You can contact us on [Discord](https://discord.gg/UCvqCsx). **[[utopian-moderator]](https://utopian.io/moderators)**
author | sedatyildiz |
---|---|
permlink | re-eresbos-php-ile-dosya-indirme-islemini-limitlendirme-turkish-tutorial-20180103t035809488z |
category | utopian-io |
json_metadata | {"tags":["utopian-io"],"community":"utopian","app":"utopian/1.0.0"} |
created | 2018-01-03 03:58:12 |
last_update | 2018-01-03 04:19:21 |
depth | 1 |
children | 0 |
last_payout | 2018-01-10 03:58:12 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 172 |
author_reputation | 4,535,285,897,770 |
root_title | "php ile dosya indirme işlemini limitlendirme (turkish tutorial)" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 26,689,694 |
net_rshares | 0 |
### Hey @eresbos I am @utopian-io. I have just upvoted you! #### Achievements - You have less than 500 followers. Just gave you a gift to help you succeed! - Seems like you contribute quite often. AMAZING! #### Suggestions - Contribute more often to get higher and higher rewards. I wish to see you often! - Work on your followers to increase the votes/rewards. I follow what humans do and my vote is mainly based on that. Good luck! #### Get Noticed! - Did you know project owners can manually vote with their own voting power or by voting power delegated to their projects? Ask the project owner to review your contributions! #### Community-Driven Witness! I am the first and only Steem Community-Driven Witness. <a href="https://discord.gg/zTrEMqB">Participate on Discord</a>. Lets GROW TOGETHER! - <a href="https://v2.steemconnect.com/sign/account-witness-vote?witness=utopian-io&approve=1">Vote for my Witness With SteemConnect</a> - <a href="https://v2.steemconnect.com/sign/account-witness-proxy?proxy=utopian-io&approve=1">Proxy vote to Utopian Witness with SteemConnect</a> - Or vote/proxy on <a href="https://steemit.com/~witnesses">Steemit Witnesses</a> [](https://steemit.com/~witnesses) **Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x**
author | utopian-io |
---|---|
permlink | re-eresbos-php-ile-dosya-indirme-islemini-limitlendirme-turkish-tutorial-20180104t072109438z |
category | utopian-io |
json_metadata | {"tags":["utopian-io"],"community":"utopian","app":"utopian/1.0.0"} |
created | 2018-01-04 07:21:09 |
last_update | 2018-01-04 07:21:09 |
depth | 1 |
children | 0 |
last_payout | 2018-01-11 07:21:09 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 1,505 |
author_reputation | 152,955,367,999,756 |
root_title | "php ile dosya indirme işlemini limitlendirme (turkish tutorial)" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 26,968,910 |
net_rshares | 0 |