Skip to content

Commit 1e8fc23

Browse files
author
Stefan Esser
committed
Delete empty temporary files if file upload hook forbids the upload
1 parent bc60e07 commit 1e8fc23

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

main/rfc1867.c

+8
Original file line numberDiff line numberDiff line change
@@ -1033,6 +1033,14 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler)
10331033
event_file_start.filename = &filename;
10341034
if (php_rfc1867_callback(MULTIPART_EVENT_FILE_START, &event_file_start, &event_extra_data TSRMLS_CC) == FAILURE) {
10351035
skip_upload = 1;
1036+
if (temp_filename) {
1037+
if (cancel_upload != UPLOAD_ERROR_E) { /* file creation failed */
1038+
close(fd);
1039+
unlink(temp_filename);
1040+
}
1041+
efree(temp_filename);
1042+
}
1043+
temp_filename="";
10361044
}
10371045
}
10381046

0 commit comments

Comments
 (0)