Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $data = base64_decode($_POST['image']);
- $filename = 'img/temp/' . ($_SERVER['REQUEST_TIME'] + 54000) . '.png';
- file_put_contents($filename, $data);
- $url = 'http://' . $_SERVER['HTTP_HOST'] . preg_replace('#[^/]+$#', '', $_SERVER['SCRIPT_NAME']) . $filename;
- $context = stream_context_create(array(
- 'http' => array(
- 'method' => 'POST',
- 'header'=> "Content-type: application/x-www-form-urlencoded\r\n",
- 'content' => 'photo=' . urlencode($url)
- )
- ));
- echo(file_get_contents($_POST['serverURL'], false, $context));
- ?>
Advertisement
Add Comment
Please, Sign In to add comment