Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

Commit 1288803

Browse files
committed
Fixed uploading
1 parent b0a6081 commit 1288803

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

examples/upload_form.php

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<form method="post" action="" enctype="multipart/form-data">
2+
<input type="file" name="file[x][y]">
3+
<input type="submit" value="submit">
4+
</form>
5+
<?php if (isset($_FILES['file']['error']['x']['y']) && is_int($_FILES['file']['error']['x']['y'])): ?>
6+
<?php if ($_FILES['file']['error']['x']['y'] === UPLOAD_ERR_OK): ?>
7+
<div id="success">SUCCESS</div>
8+
<?php else: ?>
9+
<div id="error">ERROR:<?=$_FILES['file']['error']['x']['y']?></div>
10+
<?php endif; ?>
11+
<?php endif; ?>

src/ProxyProcess.php

+6-1
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ private function pipe($client, $server)
8282
{
8383
$lines = [];
8484
$length = null;
85+
$body = '';
8586
while (true) {
8687
$line = @fgets($client);
8788
if ($line === false) {
@@ -95,7 +96,11 @@ private function pipe($client, $server)
9596
break;
9697
}
9798
}
98-
$body = $length !== null ? fread($client, $length) : '';
99+
if ($length !== null) {
100+
while (strlen($body) < $length) {
101+
$body .= fread($client, $length);
102+
}
103+
}
99104
fwrite($server, implode($lines) . $body);
100105
fwrite($client, stream_get_contents($server));
101106
}

0 commit comments

Comments
 (0)