diff options
author | Stefan Esser <sesser@php.net> | 2006-09-19 11:34:19 +0000 |
---|---|---|
committer | Stefan Esser <sesser@php.net> | 2006-09-19 11:34:19 +0000 |
commit | 1e8fc23095adb09a68a8c70bfd8e65e4e359d5c2 (patch) | |
tree | 35a5964657042aef21bd739c2e094bfb68536270 | |
parent | bc60e07d5731a1de3241ad10aac412f6915e6e68 (diff) | |
download | php-git-1e8fc23095adb09a68a8c70bfd8e65e4e359d5c2.tar.gz |
Delete empty temporary files if file upload hook forbids the upload
-rw-r--r-- | main/rfc1867.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/main/rfc1867.c b/main/rfc1867.c index 699b0cfda0..778b7455fb 100644 --- a/main/rfc1867.c +++ b/main/rfc1867.c @@ -1033,6 +1033,14 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) event_file_start.filename = &filename; if (php_rfc1867_callback(MULTIPART_EVENT_FILE_START, &event_file_start, &event_extra_data TSRMLS_CC) == FAILURE) { skip_upload = 1; + if (temp_filename) { + if (cancel_upload != UPLOAD_ERROR_E) { /* file creation failed */ + close(fd); + unlink(temp_filename); + } + efree(temp_filename); + } + temp_filename=""; } } |