Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

PHP problem: Jpeg from Flash to Server

Explorer ,
Apr 19, 2008 Apr 19, 2008
I've been on this bit of code for a couple of days and have traversed many snippets of code.
I created a drag and drop app which allows you to download the image you've created, and that works pretty well. I got the code thanks to henry jones, used the jpegencoder, forum member David Stiller helped me with that.

Anyway, what's driving me nuts may be a small thing. I found someone else who had the identical
problem, using the exact php code I was using. You can see the code there or at the bottom of this post. Deleting the second header makes the image appear directly in another window. It's a treat.

He says all he had to do to get it to work was:
problem solved
file_put_contents('filename.ext', $GLOBALS["HTTP_RAW_POST_DATA"]);

what is filename.ext? why doesn't this work for me? I thought it was just an example and switched it for thumb.jpg, a same level existing jpeg, and set permissions at 666. I get no error but no image. Tried about a hundred other things. Emailed the poster but got no answer.

anyone know what would solve this problem?
TOPICS
ActionScript
800
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 19, 2008 Apr 19, 2008
are you using GET or POST to send data to your php file?
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 19, 2008 Apr 19, 2008
POST, kglad, thanks for looking it over.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 19, 2008 Apr 19, 2008
fix your 2nd header then. you're using GET there.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 19, 2008 Apr 19, 2008
I actually have the second header //commented out, that's why you don't see a download window. I didn't make that clear, sorry.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 19, 2008 Apr 19, 2008
why's it commented out? aren't you trying to save a bitmap from flash to a local file?
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 20, 2008 Apr 20, 2008
No, look at the title, I'm trying to save it to the server, ultimately to use as part of a postcard app.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 20, 2008 Apr 20, 2008
then you need code to write the file. use:

<?php

if ( isset ( $GLOBALS["HTTP_RAW_POST_DATA"] )) {

$im = $GLOBALS["HTTP_RAW_POST_DATA"];

$fp = fopen($_GET['name'], 'wb');

fwrite($fp, $im);
fclose($fp);

} else echo 'result=An error occured.';

?>
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 20, 2008 Apr 20, 2008
Thanks KGLAD! That works exactly as needed. Do you think you can spot in the code below what I could take out, so it wouldn't also open a blank page? I thought commenting out navigatetoURL would do it, but no.

However I am THRILLED that it writes to the server.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 20, 2008 Apr 20, 2008
actually I like opening the window, I reset the code so the new image goes there as well as to the server, and it will work well, especially once I figure how to add text to it. Php is certainly exciting in its possibilities. If anyone knows of a good current book that deals with all its image manipulation abilities, I'd love to know.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 20, 2008 Apr 20, 2008
that shouldn't open a new page. clear your cache and retest. (though, you'll need to uncomment your load() method or you won't be saving anything to your server.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 20, 2008 Apr 20, 2008
LATEST
hmm, even with the cache cleared, (nd of course the load method not commented(!)) it opens another page, the php page. However, I've got it now so it goes directly into my postcard folder and can be sent, which is what got me started on this path. If I solve how to write into the window opened a link to the postcard app, (and that's about my php level) I'll be set. It does seem as if commenting out the _blank line should have stopped the new window. The url it opens is the full jpgURLRequest
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines