Any PHP /ASP.NET guru in here to translate the code below to VB.NET /C#
<?php
// PHP script to receive image data from Picnik via HTTP POST
// Make sure we've been sent an image. By default, the
// image data goes into the "file" field, but we could
// change that using the _export_field API parameter.
if (!isset($_POST['file'])) {
echo "Sorry, no image data was sent.";
exit();
}
// Save the image to disk. It'll go into the same directory as
// this script. You'D probably want to put it somewhere else in the
// file system like a "/images" directory, or maybe even into a database.
$image_data = $_POST['file'];
$image_filename = "picnik_exported_file" . time() . rand(10000,99999) + ".jpg"
file_put_contents( $image_filename, $image_data );
// Display a result to let the user know what happened. You
// might need to be smarter about how the $image_link variable is
// built, depending on how your web server is set up.
$image_link = dirname($_SERVER['PHP_SELF']) . "/" . $image_filename;
echo "Your file was saved to $image_filename.<br/>";
echo "You can find it at this URL: <a href='$image_link'>$image_link</a><br/>";
echo "<img src='$image_link'>";
?>
<?php
// PHP script to download image data from Picnik after we're given
// a temporary URL via HTTP GET.
// Make sure we've been sent an image url
if (!isset($_GET['file'])) {
echo "Sorry, no image URL was sent.";
exit();
}
$image_url = $_GET['file'];
// Make sure that the image came from picnik. We don't want anyone
// sending us data we didn't ask for!
if (0 !== stripos( $image_url, "
http://www.picnik.com")) {
echo "Sorry, the image URL doesn't seem right.";
exit();
}
// Download the image data from Picnik's servers
$image_data = file_get_contents( $$image_url );
if (FALSE === $image_data) {
// Download failed , this shouldn't happen very often,
// but you might want to put some retry logic in your app
echo "Sorry, the image download failed.";
exit();
}
// Save the image to disk. It'll go into the same directory as
// this script. You'D probably want to put somewhere else in the
// file system like a "/images" directory, or maybe even into a database.
$image_filename = "picnik_exported_file" . time() . rand(10000,99999) + ".jpg"
file_put_contents( $image_filename, $image_data );
// Display a result to let the user know what happened
$image_link = dirname($_SERVER['PHP_SELF']) . "/" . $image_filename;
echo "Your file was saved to $image_filename.<br/>";
echo "You can find it at this URL: <a href='$image_link'>$image_link</a><br/>";
echo "<img src='$image_link'>";
?>