Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> Limit wielkości ściąganych plików z serwera
aaaaa123
post 22.05.2008, 08:19:58
Post #1





Grupa: Zarejestrowani
Postów: 7
Pomógł: 0
Dołączył: 20.05.2008
Skąd: Bydgoszcz

Ostrzeżenie: (0%)
-----


Jak ograniczyć wielkość plików ściąganych z serwera (pliki >3MB nie ściągają się)?
Mam
Cytat
WebServ 2.0 (Apache 2.2.6, PHP 4.4.7/5.2.5, MySQL 4.0.26/5.0.45)

-----EDIT:-----
Odpowie mi ktoś?

Ten post edytował aaaaa123 22.05.2008, 08:20:43
Go to the top of the page
+Quote Post
ayeo
post 22.05.2008, 09:24:11
Post #2





Grupa: Przyjaciele php.pl
Postów: 1 202
Pomógł: 117
Dołączył: 13.04.2007
Skąd: 127.0.0.1

Ostrzeżenie: (0%)
-----


Możesz jaśniej opisać sytuację?


--------------------
Go to the top of the page
+Quote Post
aaaaa123
post 22.05.2008, 11:15:52
Post #3





Grupa: Zarejestrowani
Postów: 7
Pomógł: 0
Dołączył: 20.05.2008
Skąd: Bydgoszcz

Ostrzeżenie: (0%)
-----


Chcę zrobić tak, aby nie dało ściągnąć się z serwera plików większych od kilku MB (np. 5). Tak samo jak z uploadem na serwer-serwer odrzuca pliki większe od xMB.
Go to the top of the page
+Quote Post
ayeo
post 22.05.2008, 11:28:39
Post #4





Grupa: Przyjaciele php.pl
Postów: 1 202
Pomógł: 117
Dołączył: 13.04.2007
Skąd: 127.0.0.1

Ostrzeżenie: (0%)
-----


LimitRequestBody directive
Syntax: LimitRequestBody bytes
Default: LimitRequestBody 0
Context: server config, virtual host, directory, .htaccess
Status: core
Compatibility: LimitRequestBody is only available in Apache 1.3.2 and later. This directive specifies the number of bytes from 0 (meaning unlimited) to 2147483647 (2GB) that are allowed in a request body.

The LimitRequestBody directive allows the user to set a limit on the allowed size of an HTTP request message body within the context in which the directive is given (server, per-directory, per-file or per-location). If the client request exceeds that limit, the server will return an error response instead of servicing the request. The size of a normal request message body will vary greatly depending on the nature of the resource and the methods allowed on that resource. CGI scripts typically use the message body for passing form information to the server. Implementations of the PUT method will require a value at least as large as any representation that the server wishes to accept for that resource.

This directive gives the server administrator greater control over abnormal client request behavior, which may be useful for avoiding some forms of denial-of-service attacks.

If, for example, you are permitting file upload to a particular location, and wich to limit the size of the uploaded file to 100K, you might use the following directive:

LimitRequestBody 102400


--------------------
Go to the top of the page
+Quote Post
aaaaa123
post 22.05.2008, 11:43:26
Post #5





Grupa: Zarejestrowani
Postów: 7
Pomógł: 0
Dołączył: 20.05.2008
Skąd: Bydgoszcz

Ostrzeżenie: (0%)
-----


Nie wiem o co w tym chodzi :-(
Go to the top of the page
+Quote Post
.radex
post 22.05.2008, 16:16:12
Post #6





Grupa: Zarejestrowani
Postów: 1 657
Pomógł: 125
Dołączył: 29.04.2006

Ostrzeżenie: (0%)
-----


w skrócie o to, że Apache przy konfiguracji jaką masz odrzuca pliki większe od 3MB.

Musisz w konfiguracji edytować LimitRequestBody (o ile dobrze rozumiem), np. jeśli chcesz, żeby można było ściągać pliki do ~10MB ustaw

LimitRequestBody 10000000


--------------------
blog | Tadam — minutnik do Pomodoro na Maka :)
Go to the top of the page
+Quote Post
aaaaa123
post 22.05.2008, 19:45:28
Post #7





Grupa: Zarejestrowani
Postów: 7
Pomógł: 0
Dołączył: 20.05.2008
Skąd: Bydgoszcz

Ostrzeżenie: (0%)
-----


Cytat
o ile dobrze rozumiem

Czyli nikt nie ściągnie pliku większego (z serwera na swój komputer) od 10MB (bo upload to ja wiem jak)?
Go to the top of the page
+Quote Post
.radex
post 22.05.2008, 20:19:50
Post #8





Grupa: Zarejestrowani
Postów: 1 657
Pomógł: 125
Dołączył: 29.04.2006

Ostrzeżenie: (0%)
-----


jeśli ustawisz

LimitRequestBody 10000000

tak.

btw. nie 10MB tylko około 10MB, bo 1KB == 1024B, a nie 1000B


--------------------
blog | Tadam — minutnik do Pomodoro na Maka :)
Go to the top of the page
+Quote Post
aaaaa123
post 25.05.2008, 17:54:47
Post #9





Grupa: Zarejestrowani
Postów: 7
Pomógł: 0
Dołączył: 20.05.2008
Skąd: Bydgoszcz

Ostrzeżenie: (0%)
-----


Cytat
btw. nie 10MB tylko około 10MB, bo 1KB == 1024B, a nie 1000B
To wiem ;-).


---EDIT---:
Ale to nie ogranicza plików .mp3, .avi itd. Da się je też ograniczyć?

Bo pliki .html raczej nie mają takich rozmiarów.

-----EDIT:-----
Powie mi ktoś?

-------Edit:-----
Odpowie mi ktoś questionmark.gif questionmark.gif

-------Edit:-----
Odpowie mi ktośquestionmark.gifquestionmark.gif

-------Edit:-----
Odpowie mi ktośquestionmark.gifquestionmark.gif

Ten post edytował aaaaa123 25.05.2008, 11:09:27
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 19.07.2025 - 10:14