From 7398db609777b63038f1193bbdeb7697254d35e9 Mon Sep 17 00:00:00 2001 From: mwilliams Date: Fri, 7 Jun 2013 11:56:17 -0700 Subject: [PATCH] Keep the uploaded data when a partial upload error occurs When we get an UPLOAD_ERROR_C, record the filename and the size as usual. I've not been able to test this - I can't get a partial uplaod, even by quitting from firefox during the upload. I seem to either get a full upload, or nothing at all. --- hphp/runtime/base/server/upload.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hphp/runtime/base/server/upload.cpp b/hphp/runtime/base/server/upload.cpp index d6a60bb73..da53c9b1a 100644 --- a/hphp/runtime/base/server/upload.cpp +++ b/hphp/runtime/base/server/upload.cpp @@ -995,7 +995,7 @@ void rfc1867PostHandler(Transport *transport, } } - if (cancel_upload) { + if (cancel_upload && cancel_upload != UPLOAD_ERROR_C) { if (temp_filename) { if (cancel_upload != UPLOAD_ERROR_E) { /* file creation failed */ unlink(temp_filename); @@ -1075,7 +1075,7 @@ void rfc1867PostHandler(Transport *transport, s = nullptr; /* Possible Content-Type: */ - if (cancel_upload || + if ((cancel_upload && cancel_upload != UPLOAD_ERROR_C) || !(cd = php_mime_get_hdr_value(header, "Content-Type"))) { cd = ""; } else {