Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,195,268 members, 7,957,660 topics. Date: Tuesday, 24 September 2024 at 05:05 PM |
Nairaland Forum / Science/Technology / Programming / Convert Code From Php To Vb.net (10012 Views)
Converting .php To .exe / Here Is How To Get The Source Code From Any APK File / Post Ur Vb 6.0 Questions Here (2) (3) (4)
(1) (Reply)
Convert Code From Php To Vb.net by Kobojunkie: 11:20pm On Nov 02, 2007 |
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'>"; ?> |
Re: Convert Code From Php To Vb.net by skima(m): 5:16pm On Nov 06, 2007 |
this itself is having error. $_POST['file']/ $_GET['file'] should be change to $_FILES['file']; |
Re: Convert Code From Php To Vb.net by Kobojunkie: 5:34pm On Nov 06, 2007 |
Just translate it. I can take care of the errors mysel in vb.net but not in php |
(1) (Reply)
Gov Ambode Has Plans For One Million Lucky Lagosians / Application Development Using Csharp (C#) / Architectural Differences Between Virtual And Non-Virtual Machines
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 12 |