aboutsummaryrefslogtreecommitdiff
path: root/lib/formdata.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/formdata.c')
-rw-r--r--lib/formdata.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/lib/formdata.c b/lib/formdata.c
index 5419371de..aa5a79ac1 100644
--- a/lib/formdata.c
+++ b/lib/formdata.c
@@ -1134,15 +1134,17 @@ CURLcode Curl_getformdata(struct SessionHandle *data,
/* it should be noted that for the HTTPPOST_FILENAME and
HTTPPOST_CALLBACK cases the ->showfilename struct member is always
assigned at this point */
- char *filebasename=
- (!post->showfilename)?strippath(post->contents):NULL;
-
- result = AddFormDataf(&form, &size,
- "; filename=\"%s\"",
- (post->showfilename?post->showfilename:
- filebasename));
- if(filebasename)
- free(filebasename);
+ if(post->showfilename || (post->flags & HTTPPOST_FILENAME)) {
+ char *filebasename=
+ (!post->showfilename)?strippath(post->contents):NULL;
+
+ result = AddFormDataf(&form, &size,
+ "; filename=\"%s\"",
+ (post->showfilename?post->showfilename:
+ filebasename));
+ if(filebasename)
+ free(filebasename);
+ }
if(result)
break;