0

I am a complete beginner in Flash & Actionscript.

My pet project is this: To provide a www.imageshack.com like service where people could upload single images and later anyone can view it using the generated url.

So far I have gotten to upload an image using Flash and store it in a directory.

http://pixels.guygar.com/

You can check the uploaded image at:

http://pixels.guygar.com/warehouse/

The issue being, I was under the impression when the PHP file is called to store the image in the folder /warehouse the browser would automatically navigate to:

http://pixels.guygar.com/upload.php

Where I can process the image i.e. generate a unique file name and provide the user with a unique URL to later access the resource.

What is happening is the image gets uploaded by the PHP script but the browser page still stays the same page even when providing a new url in the PHP script.

So the question is how do I go about so that a new URL (image resource linked) is passed back to the flash so that onComplete is called I can navigate to image that was just loaded? Or other ways of doing such?

I welcome your perspectives on this issue and thank you for your guidance.

iTEgg
  • 8,212
  • 20
  • 73
  • 107

2 Answers2

0

i would store all values that you need later on in a session on the server (don't forget to pass the sessionID to the upload-script via GET).

at the end of the PHP script you just return "ok" (or "ko" if sth went wrong) to flash and then (in the callback/listener) call/load a second PHP-script that's doing the rest ... and returns you an URL to a thumbnail or whatever you want to do.

hope this points you in the right direction ...

Philipp Kyeck
  • 18,402
  • 15
  • 86
  • 123
  • food for thought. thank you, will investigate your tips further. – iTEgg Jul 11 '11 at 17:19
  • To me, it seems like your problem is in the PHP script but not in the Flash part. Like pkyeck said, I'd investigate your return code. If you are sending back XML structure, consider adding header to PHP so it pushes XML data to the Flash end. I think we don't need a second PHP script in this case. As soon as your image is uploaded, your PHP script can create a response. – Kumsal Obuz Jul 12 '11 at 14:44
  • i think the last time i did this, i was using amfphp and a extra file handling the upload - had to make two calls ;) – Philipp Kyeck Jul 12 '11 at 15:09
0

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/FileReference.html?filter_flash=cs5&filter_flashplayer=10.2&filter_air=2.6#event:uploadCompleteData

Shows how data can be returned to flash after an upload.

iTEgg
  • 8,212
  • 20
  • 73
  • 107