Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(241)

Side by Side Diff: LayoutTests/http/tests/xmlhttprequest/resources/multipart-post-echo.php

Issue 157363003: Implement Blob.close(). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebased Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <?php 1 <?php
2 if (strpos($_SERVER['CONTENT_TYPE'], 'multipart/form-data; boundary=') != 0) { 2 if (strpos($_SERVER['CONTENT_TYPE'], 'multipart/form-data; boundary=') != 0) {
3 echo 'Invalid Content-Types.'; 3 echo 'Invalid Content-Types.';
4 return; 4 return;
5 } 5 }
6 6
7 $values = array(); 7 $values = array();
8 8
9 foreach ($_POST as $key => $value) { 9 foreach ($_POST as $key => $value) {
10 $values[] = "$key=$value"; 10 $values[] = "$key=$value";
11 } 11 }
12 12
13 foreach ($_FILES as $key => $value) { 13 foreach ($_FILES as $key => $value) {
14 $file = $_FILES[$key]; 14 $file = $_FILES[$key];
15 if ($file['error']) { 15 if ($file['error']) {
16 echo 'Upload file error: ' . $file['error']; 16 echo 'Upload file error: ' . $file['error'];
17 return; 17 return;
18 } else { 18 } else {
19 $fp = fopen($file['tmp_name'], 'r'); 19 $fp = fopen($file['tmp_name'], 'r');
20 if ($fp) { 20 if ($fp) {
21 $content = fread($fp, $file['size']); 21 $content = $file['size'] > 0 ? fread($fp, $file['size']) : "";
22 fclose($fp); 22 fclose($fp);
23 } 23 }
24 $values[] = $key . '=' . $file['name'] . ':' . $file['type'] . ':' . $co ntent; 24 $values[] = $key . '=' . $file['name'] . ':' . $file['type'] . ':' . $co ntent;
25 } 25 }
26 } 26 }
27 27
28 echo join('&', $values); 28 echo join('&', $values);
29 ?> 29 ?>
OLDNEW
« no previous file with comments | « LayoutTests/http/tests/xmlhttprequest/post-formdata-expected.txt ('k') | Source/core/dom/DOMURL.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698