Ben bir PHP tabanlı, bilet yönetim sisteminin üzerinde çalışıyorum. Bir bilet oluştururken, tek bir eki yükleyebilirsiniz.
I want to put a limit (say 10 MB) per file upload.
To implement this I plan the following-
1. In php.ini set
post_max_size = 10M
2.In PHP script which receives the POST-
Since the file is larger than post_max_size, $_FILES[] will be empty. But I can still check the content-length header and discard the upload, if size more than 10M.
Bu test ederken 1 GB bir dosya yükleyerek denedim ve http trafiği analiz ve bu ne buldum.
-> Tüm 1 GB veri Önce geçici olarak sunucuya bir yüklenen ve http isteği tamamladığında atılır. (O. Sunucusu geçici dizinde orada değildi gibi), ama benim http trafik analisti tarayıcı sunucuya 1 GB veri göndermek olmadığını gösterdi dosya kaydedildiğinde başlamıştı nerede tam olarak bulamadım gerçi.
-> PHP komut dosyası yürütme http isteği tamamlandıktan sonra sadece başladı (yani tüm 1 GB yüklemeden sonra)
Now I have 2 concerns:
a) People may exploit my server bandwidth by trying to upload large file, which I will have to discard anyways.
b) Even worse,
if someone starts uploading a huge file (say 100 GB), entire 100 GB data is first uploaded to the server temporarily, that means for that period, it will consume that much of memory on my server.
What's the common solution for this. Am I missing something here?