Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: Limit wielkości ściąganych plików z serwera
Forum PHP.pl > Forum > Serwery WWW > Apache
aaaaa123
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ś?
ayeo
Możesz jaśniej opisać sytuację?
aaaaa123
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.
ayeo
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
aaaaa123
Nie wiem o co w tym chodzi :-(
.radex
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
aaaaa123
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)?
.radex
jeśli ustawisz

LimitRequestBody 10000000

tak.

btw. nie 10MB tylko około 10MB, bo 1KB == 1024B, a nie 1000B
aaaaa123
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
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.