Heres a real toughy.
I made a Flash "image upload" button with an .html pop up and .php page to give status and a IMG tag of the uploaded image. They work fine, but all I need is the images to come up IN FLASH once they are uploaded throught the HTML form, and after the PHP page that shows the image.
The way I want to do it is with a "load variables" button, that will add the PHP variables and plug them into a "loadmovienum" URL destination. And then the "load movienum" will put the .jpg (recently uploaded into the "uploads" folder) into a targeted movieclip target.
Hard to describe. So I've put the html and php scripts below:
to make it work, you need
- a swf: mine was generated by ming, but you can as well make your own fla and copy the actionscripts; the important part is a loader movieclip
- an "index" type php age that holds the movie, and contains javascript to open a popup, and another one to call back the movie (admin.php)
- another php page that comes up when the upload is finished; this one contains a javascript call to the opener (the page that opened the popup) (imageupload.php + jpeg.php)
- a writable tmp directory (chmod 777) for the uploaded images
The connection between the two php parts is established via php session
sorry, I'm not following that well (I'm a dumb designer), I need to make an index.php page that holds a .swf with a loading MC for the loadMovieNum and a button with this:
Then I need to make a folder with the chmod = 777? Or do I have to change the chmod of a php file.
Is their any way you could send me the whole collection of files to upload? I would really really apprieciate it! I've been trying to figure this out for 3 days! I'm losing my mind.
this time there is a swf as well (there never was a fla, just a php)
admin.php acts as an index file once you are logged in
it creates a popup and uses javascript to copy the upload form into the popup
The folder (which is called tmp here - the name is set in the imageupload.php) requires 777 permissions
A short explanation of the callback to movie: the finished upload calls a function imageready() in the html container. This function uses javascript calls to set variables in the movie, and then play()s a clip. The clip is stopped at frame 1, calls a flash function in frame 2, nd hen stops again at 1.
I uploaded all of the files in the folder and I made a 777 folder and It still doesen't work. What am I missing? after I login with UN:image and PW:upload, I just get a blank screen?
Here's an example that uses getURl to call a javascript function that opens a php upload window. This window has an upload form, and when the upload is complete, it use javascript to send the URL of the uploaded JPEG to the swf movie, which has an onEnterFrame function checking for the URL and then using it in a loadMovie call.
The attached zip file has the HTML for the swf movie, and the AS for the swf movie, and the PHP for the upload form (very basic, you should add more error-checking).
Hey Jerryscript, I uploaded all of the files, and after I try to upload a file, a error message comes up? It says:
Warning: move_uploaded_file(avatar.jpg): failed to open stream: Permission denied in /home/sites/www.joeweitzel.com/web/illustrationspot/flashupload/upload.php on line 7
Warning: move_uploaded_file(): Unable to move '/tmp/phpkTuwyp' to 'avatar.jpg' in /home/sites/www.joeweitzel.com/web/illustrationspot/flashupload/upload.php on line 7
ERROR -- Could not upload the file!
Here's some debugging info:
Array
(
[userfile] => Array
(
[name] => avatar.jpg
[type] => image/jpeg
[tmp_name] => /tmp/phpkTuwyp
[error] => 0
[size] => 4510
)
Just add it where you want the upload button to be in your movie, no need to include it.
Don't forget to add the spawn javascript code for opening the upload window. The upload window has javascript that passes the URL of the uploaded image back to the flash movie, and it is dependant upon being opened by the flash movie's window. Also, the movie must be named and ID'd "movie" in the object/embed tags (see zip files).
Be sure to change the levels of both the imageHolder and grabButton to unused levels in your movie. It's written with 1 & 2, I should have written it with something like 1000 and 2000, but you never know what level values people will be using.
What do you mean the movie must be named and ID'd "movie" in the object/embed tags. I still can't get the jpegs to load into flash? Do I have to make specific changes to the .swf? HERE is what I have so far, but after the file is uploaded the loadmovie doesn't occur in the .swf?
Has it worked for you?
Thanks!!
Last edited by falshdancer; 06-02-2004 at 07:58 PM.
I viewed the source of the page you posted, and you already have the appropriate HTML, so I decompiled your swf file, and found that you are using onEnterFrame in a clip event for your button bouncing. This replaces the onEnterFrame in my code that checks for the new imageURL.
Try placing my onEnterFrame code at the begining of yours (right before _x=_xscale), I think that will work.
Last edited by JerryScript; 06-02-2004 at 08:39 PM.
Hi MusicMan,
No I haven't had luck with anything? I have no problem with uploading with anyone's scripts, but the "loading the .jpg back into flash automatically" seems to want to give me a head ache! Yours is the one I really wanted to get working because the form is actually inside the flash page and not a popup, but I can't get it to work either. Have you seen it actually load the jpeg in the .swf automatically?
Last edited by falshdancer; 06-03-2004 at 02:58 AM.
well, it works for me (different netscape / mozilla versions on linux) and it seems to work with ie / windows.
One of the first comments about this not working was from a safari user, and at that time I added the update button to the movie
Unfortunately the test link you sent me does no longer work
Yeah I deleted it on my server but if ya want to see it Click HERE
When you log in the screen goes blank? Am I suppose too embed the .swf inside one of the .phps? I'm going INSANE! Also One I have logged in, then the admin page is always blank even after I refresh. Is there any security that I have to change to 777?
Thanks Again Music Man!
Last edited by falshdancer; 06-03-2004 at 03:59 AM.