icusbeck Posted August 2, 2007 Share Posted August 2, 2007 Okay. This must be easier than i'm making it. Essentially, I have a flash shockwave file, where a user can drag icons around. I want to be able to click a button and save the flash shocwave file to a server. So far, I've managed to convert the flash shockwave to a static jpg image, which I'm happy to do. But how, do I now upload the jpg that I have created to the server. Here is the code I used to create the jpg from the flash file, which all works fine: pixel data (pixel colour/alpha) is first sent from flash to my php file: My (simplified) Php file: //'img' contains the pixel data sent from flash $data = explode(",", $_POST['img']); $height = $_POST['height']; $width = $_POST['width']; //Allocate image $image=imagecreatetruecolor( $width ,$height ); //This bit loops through $data[$i]; $r = hexdec(substr( $data[$i] , 0 , 2 )); $g = hexdec(substr( $data[$i] , 2 , 2 )); $b = hexdec(substr( $data[$i] , 4 , 2 )); $color = imagecolorallocate($image, $r, $g, $b); imagesetpixel ($image,$x,$y,$color); //Output image and clean header( "Content-type: image/jpeg" ); ImageJPEG( $image ); imagedestroy( $image ); This perfectly displays my flash file as a jpg on a new page. Great. Now, how do I upload it to a server? Any help would be greatly appreciated. Thanks in advance. Icus. ??? Quote Link to comment https://forums.phpfreaks.com/topic/63054-upload-an-image/ Share on other sites More sharing options...
deadimp Posted August 2, 2007 Share Posted August 2, 2007 Look at imagejpg() in the PHP documentation, and it'll tell you how to save the image to a file. Quote Link to comment https://forums.phpfreaks.com/topic/63054-upload-an-image/#findComment-314098 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.