Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if ($_SERVER['REQUEST_METHOD'] == 'PUT') {
- $boundary = uniqid();
- $content = "--$boundary\r\n";
- $content .= "content-disposition: form-data; name=\"photo\"; filename=\"1.jpg\"\r\n";
- $content .= "Content-Type: image/jpeg\r\n";
- $content .= "Content-Transfer-Encoding: binary\r\n\r\n";
- $content .= file_get_contents('php://input') . "\r\n";
- $content .= "--$boundary--\r\n";
- $context = stream_context_create(array(
- 'http' => array(
- 'method' => 'POST',
- 'header'=> "Content-type: multipart/form-data, boundary=$boundary\r\nContent-Length: " . strlen($content),
- 'content' => $content
- )
- ));
- echo( file_get_contents($_GET['url'], false, $context) );
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment