From: Stanislav Malyshev Date: Sun, 30 Jul 2000 11:22:18 +0000 (+0000) Subject: Fix file upload types array handling (#5836) X-Git-Tag: PRE_FILE_COMPILE_API_CHANGE~73 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a790966b155e6bdafdf44d2f9f7bce9a0fa4f0f8;p=php Fix file upload types array handling (#5836) --- diff --git a/main/rfc1867.c b/main/rfc1867.c index b6a7aeac17..99165c3180 100644 --- a/main/rfc1867.c +++ b/main/rfc1867.c @@ -195,31 +195,34 @@ static void php_mime_split(char *buf, int cnt, char *boundary, zval *array_ptr) } state = 3; + s = ""; if ((loc2 - loc) > 2) { if (!strncasecmp(loc + 1, "Content-Type:", 13)) { *(loc2 - 1) = '\0'; - - /* Add $foo_type */ - if (is_arr_upload) { - sprintf(lbuf, "%s_type[%s]", abuf, arr_index); - } else { - sprintf(lbuf, "%s_type", namebuf); - } - php_register_variable(lbuf, loc+15, NULL ELS_CC PLS_CC); - - /* Add $foo[type] */ - if (is_arr_upload) { - sprintf(lbuf, "%s[type][%s]", abuf, arr_index); - } else { - sprintf(lbuf, "%s[type]", namebuf); - } - register_http_post_files_variable(lbuf, loc+15, http_post_files ELS_CC PLS_CC); - - *(loc2 - 1) = '\n'; + s = loc+15; } rem -= 2; ptr += 2; } + + /* Add $foo_type */ + if (is_arr_upload) { + sprintf(lbuf, "%s_type[%s]", abuf, arr_index); + } else { + sprintf(lbuf, "%s_type", namebuf); + } + php_register_variable(lbuf, s, NULL ELS_CC PLS_CC); + + /* Add $foo[type] */ + if (is_arr_upload) { + sprintf(lbuf, "%s[type][%s]", abuf, arr_index); + } else { + sprintf(lbuf, "%s[type]", namebuf); + } + register_http_post_files_variable(lbuf, s, http_post_files ELS_CC PLS_CC); + if(*s != '\0') { + *(loc2 - 1) = '\n'; + } } break;