Index: modules/simpletest/drupal_web_test_case.php =================================================================== RCS file: /cvs/drupal/drupal/modules/simpletest/drupal_web_test_case.php,v retrieving revision 1.12 diff -u -r1.12 drupal_web_test_case.php --- modules/simpletest/drupal_web_test_case.php 3 Jun 2008 13:45:07 -0000 1.12 +++ modules/simpletest/drupal_web_test_case.php 3 Jun 2008 16:44:56 -0000 @@ -600,29 +623,12 @@ // We post only if we managed to handle every field in edit and the // submit button matches. if (!$edit && $submit_matches) { - // This part is not pretty. There is very little I can do. - if ($upload) { - foreach ($post as &$value) { - if (strlen($value) > 0 && $value[0] == '@') { - $this->fail(t("Can't upload and post a value starting with @")); - return FALSE; - } - } - foreach ($upload as $key => $file) { - $post[$key] = '@' . realpath($file); - } - } - else { - $post_array = $post; - $post = array(); - foreach ($post_array as $key => $value) { - // Whether this needs to be urlencode or rawurlencode, is not - // quite clear, but this seems to be the better choice. - $post[] = urlencode($key) . '=' . urlencode($value); - } - $post = implode('&', $post); + $post = array(); + // cURL will handle file upload for us is asked kindly + foreach ($upload as $key => $file) { + $post[$key] = '@' . realpath($file); } - $out = $this->curlExec(array(CURLOPT_URL => $action, CURLOPT_POSTFIELDS => $post, CURLOPT_POST => TRUE)); + $out = $this->curlExec(array(CURLOPT_URL => $action, CURLOPT_POST => TRUE, CURLOPT_POSTFIELDS => $post)); // Ensure that any changes to variables in the other thread are picked up. $this->refreshVariables(); return $out;