Is there any way to write same functionality in jsp to send data to server?
I want to capture image from Flash using Java and send it to the server. Everywhere I search I get the same script to send it to server. Can’t jsp do this?
<?php
if ( isset ( $GLOBALS["HTTP_RAW_POST_DATA"] )) {
$uniqueStamp = date(U);
$filename = $uniqueStamp.".jpg";
$fp = fopen( $filename,"wb");
fwrite( $fp, $GLOBALS[ 'HTTP_RAW_POST_DATA' ] );
fclose( $fp );
echo "filename=".$filename."&base=".$_SERVER["HTTP_HOST"].dirname($_SERVER["PHP_SELF"]);
}
?>
One of the easiest ways to upload a file in Java is to leverage Apache Commons FileUpload. Writing a file is trivial – using core classes from
java.io.