Index: src/main.c
===================================================================
RCS file: /cvsroot/curl/curl/src/main.c,v
retrieving revision 1.361
diff -u -r1.361 main.c
--- src/main.c	22 Jun 2006 21:36:54 -0000	1.361
+++ src/main.c	24 Jun 2006 19:38:45 -0000
@@ -898,6 +898,7 @@
   char major[128];
   char minor[128];
   char *contp;
+  char *_contp;
   const char *type = NULL;
   char *sep;
   char *sep2;
@@ -927,9 +928,12 @@
         char *ptr;
         char *filename=NULL;
 
-        sep=strchr(contp, FORM_TYPE_SEPARATOR);
-        sep2=strchr(contp, FORM_FILE_SEPARATOR);
-
+//        sep=strchr(contp, FORM_TYPE_SEPARATOR);
+//        sep2=strchr(contp, FORM_FILE_SEPARATOR);
+        _contp=contp;
+        while( (sep=strchr(_contp, FORM_TYPE_SEPARATOR)) && (((char *)strchr(_contp, FORM_TYPE_SEPARATOR)-1)[0]=='\\') )_contp=sep+1;
+        while( (sep2=strchr(_contp, FORM_FILE_SEPARATOR)) && (((char *)strchr(_contp, FORM_FILE_SEPARATOR)-1)[0]=='\\') )_contp=sep2+1;
+ 
         /* pick the closest */
         if(sep2 && (sep2 < sep)) {
           sep = sep2;
@@ -1001,6 +1005,8 @@
         }
         else {
           sep=strchr(contp, FORM_FILE_SEPARATOR);
+          _contp=contp;
+          while( (sep=strchr(_contp, FORM_FILE_SEPARATOR)) && (((char *)strchr(_contp, FORM_FILE_SEPARATOR)-1)[0]=='\\') )_contp=sep+1;
         }
         if(sep) {
           /* the next file name starts here */
@@ -1009,6 +1015,14 @@
         }
         /* if type == NULL curl_formadd takes care of the problem */
 
+        _contp=contp;
+        while(*_contp!='\0') {
+          if(*_contp=='\\' && *(_contp+1)==',') {
+          strcpy(_contp,_contp+1);
+          }
+          _contp++;
+        }
+
         if (!AddMultiFiles (contp, type, filename, &multi_start,
                             &multi_current)) {
           warnf(config, "Error building form post!\n");
