summaryrefslogtreecommitdiff
path: root/main/rfc1867.c
diff options
context:
space:
mode:
authorZeev Suraski <zeev@php.net>2000-04-02 21:27:32 +0000
committerZeev Suraski <zeev@php.net>2000-04-02 21:27:32 +0000
commit18e0850ba17c49de4df15463221fe06027eef01a (patch)
tree7161948804c364e83fb2bc71d30fc72021be755f /main/rfc1867.c
parentde0d354736a08e2218d37dfe70314f81cf765839 (diff)
downloadphp-git-18e0850ba17c49de4df15463221fe06027eef01a.tar.gz
@- Add $HTTP_POST_FILES[filename][tmp_name] - it was previously impossible to
@ retrieve the temporary name of an uploaded file using $HTTP_POST_FILES[] (Zeev) - Changed IMAP Win32 definitions
Diffstat (limited to 'main/rfc1867.c')
-rw-r--r--main/rfc1867.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/main/rfc1867.c b/main/rfc1867.c
index bca099689d..e43aeecc9a 100644
--- a/main/rfc1867.c
+++ b/main/rfc1867.c
@@ -30,6 +30,9 @@
#define NEW_BOUNDARY_CHECK 1
#define SAFE_RETURN { if (namebuf) efree(namebuf); if (filenamebuf) efree(filenamebuf); if (lbuf) efree(lbuf); return; }
+/* The longest property name we use in an uploaded file array */
+#define MAX_SIZE_OF_INDEX sizeof("[tmpname]")
+
static void register_http_post_files_variable(char *strvar, char *val, zval *http_post_files ELS_DC PLS_DC)
{
@@ -126,7 +129,7 @@ static void php_mime_split(char *buf, int cnt, char *boundary, zval *array_ptr)
if (lbuf) {
efree(lbuf);
}
- lbuf = emalloc(s-name + MAX(MAX(sizeof("[name]"),sizeof("[size]")),sizeof("[type]")));
+ lbuf = emalloc(s-name + MAX_SIZE_OF_INDEX);
state = 2;
loc2 = memchr(loc + 1, '\n', rem);
rem -= (loc2 - ptr) + 1;
@@ -267,6 +270,10 @@ static void php_mime_split(char *buf, int cnt, char *boundary, zval *array_ptr)
}
}
php_register_variable(namebuf, fn, NULL ELS_CC PLS_CC);
+
+ /* Add $foo[tmp_name] */
+ sprintf(lbuf, "%s[tmp_name]", namebuf);
+ register_http_post_files_variable(lbuf, fn, http_post_files ELS_CC PLS_CC);
{
zval file_size;