|
 |
Опция MAX_FILE_SIZE не должна позволять передачу файлов,
размер которых превышает лимит, установленный конфигурационной директивой
upload_max_filesize.
Ограничение по умолчанию составляет 2 мегабайта.
В случае, если установлено ограничения памяти, вам может понадобиться
увеличить значение опции memory_limit.
Убедитесь в том, что значение memory_limit
достаточно велико.
В случае, если опция max_execution_time
установлена слишком маленьким значением, необходимое время работы скрипта
может превышать это значение. Убедитесь в том, что значение
max_execution_time достаточно велико.
Замечание:
Директива max_execution_time only
касается исключительно времени, используемого непосредственно самим скриптом.
Время, потраченное на внешние действия, такие как системные
вызовы при помощи функции system() или
sleep(), обращения к базе данных, а также
время, потраченное на загрузку файла и другие действия, происходящие
вне скрипта, не учитываются при определении максимально допустимого
промежутка времени, отведенного для выполнения скрипта.
Внимание |
Директива max_input_time указывает
максимально допустимое время в секундах для получения входящих данных,
в том числе и загружаемых файлов. В случае, если вы имеете дело с несколькими
или большими файлами, либо удаленные пользователи используют медленный
канал, ограничение по умолчанию в 60 секунд может быть превышено.
|
Если директива post_max_size
установлена слишком маленьким значением, большие файлы не смогут быть
загружены на сервер. Убедитесь, что значение директивы
post_max_size достаточно велико.
Если не проверять, с какими файлами вы работаете, пользователи могут
получить доступ к конфиденциальной информации, расположенной в других
директориях.
Следут заметить, что CERN httpd может отсечь все, что идет после первого
пробела в получаемом от клиента заголовке content-type. Если у вас именно
такой случай, CERN httpd не будет поддерживать возможность загрузки файлов.
Поскольку разные системы по-разному работают с файловой структурой,
у вас нет никаких гарантий того, что файлы с экзотическими именами
(например, которые содержат пробельные символы) будут обработаны корректно.
Разработчики не должны использовать одинаковые имена для полей ввода и полей
выбора файла в пределах одной и той же формы (например, используя имя
вида foo[]).
Наиболее распространенные ошибки
rbemrose at gmail dot com
20-Dec-2005 01:07
tjaart:
The HTTP/1.1 standard, section 4.2 says this about message headers:
"Each header field consists of a name followed by a colon (":") and the field value. Field names are case-insensitive. The field value MAY be preceded by any amount of LWS, though a single SP is preferred."
This can be interpreted in two ways:
1. You have to have at least one whitespace character between the header name and field value.
or
2. You can have no whitespace before the field value.
Either way, the standard recommends 1 space, and you already know that works...
tjaart at siam-data-services dot com
22-May-2005 01:27
Took me a while to figure this one out...
I think this is actually a header problem, but it only
happens when doing a file upload.
If you attept a header("location:http://...) redirect after
processing a $_POST[''] from a form doing a file upload
(i.e. having enctype="multipart/form-data"), the redirect
doesn't work in IE if you don't have a space between
location: & http, i.e.
header("location:http://...) vs
header("location: http://...)
===================================
<?php
if ($_POST['submit']=='Upload') {
header("location: http://"..."/somewhere.php");
exit;
}
?>
<html><head></head><body>
<form enctype="multipart/form-data" action="upload.php" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="20000">
Your file: <input name="filename" type="file">
<input name="submit" type="submit" value="Upload">
</form>
</body></html>
===================================
This only happens if all of the following are true:
header("location:http://...) with no space
Form being processed has enctype="multipart/form-data"
Browser=IE
To fix the problem, simply add the space.
Hope this helps someone else.
amalcon _a_t_ eudoramail _d_o_t_ com
11-Aug-2004 02:35
Note that, when you want to upload VERY large files (or you want to set the limiters VERY high for test purposes), all of the upload file size limiters are stored in signed 32-bit ints. This means that setting a limit higher than about 2.1 GB will result in PHP seeing a large negative number. I have not found any way around this.
morganaj at coleggwent dot ac dot uk
21-Oct-2003 09:53
Here is another that may make your upload fall over. If you are using Squid or similar proxy server make sure that this is not limiting the size of the HTTP headers. This took me weeks to figure out!
tomcashman at unitekgroup dot com
09-Jun-2003 06:59
For apache, also check the LimitRequestBody directive.
If you're running a Red Hat install, this might be set in /etc/httpd/conf.d/php.conf.
By default, mine was set to 512 KB.
sebastian at drozdz dot ch
28-Apr-2003 03:59
It's important that the variable 'open_basedir' in php.ini isn't set to a directory that doesn't not includes tempupload directory
admin at creationfarm dot com
04-Feb-2003 08:16
The macintosh OS (not sure about OSx) uses a dual forked file system, unlike the rest of the world ;-). Every macintosh file has a data fork and a resource fork. When a dual forked file hits a single forked file system, something has to go, and it is the resource fork. This was recognized as a problem (bad idea to begin with) and apple started recomending that developers avoid sticking vital file info in the resource fork portion of a file, but some files are still very sensitive to this. The main ones to watch out for are macintosh font files and executables, once the resource fork is gone from a mac font or an executable it is useless. To protect the files they should be stuffed or zipped prior to upload to protect the resource fork.
Most mac ftp clients (like fetch) allow files to be uploaded in Macbinhex, which will also protect the resource fork when transfering files via ftp. I have not seen this equivilent in any mac browser (but I haven't done too much digging either).
FYI, apple does have an old utility called ResEdit that lets you manipulate the resource fork portion of a file.
| |