A Flash Developer Resource Site

Page 1 of 3 123 LastLast
Results 1 to 20 of 48

Thread: If you can solve this one your a genius.

  1. #1
    if(i>$){i=:);} falshdancer's Avatar
    Join Date
    Nov 2003
    Location
    NYC
    Posts
    546

    If you can solve this one your a genius.

    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:
    Code:
    <HTML>
    <HEAD>
    <TITLE>Movie2</TITLE>
    </HEAD>
    <BODY bgcolor="#FFFFFF">
    <form action='upload.php' method='post' enctype='multipart/form-data'>
    <table cellspacing='10' style='background: #DDD; border: solid #009;
    border-width: .3em 0 .5em 0;'>
    <tr>
    <th colspan='2' style='background: #BBB; color: #000;
    text-align: center; padding: .3em;'>File Upload</th>
    </tr>
    <tr>
    <td style='vertical-align: middle'><b>FILER &gt;</b></td>
    <td><input type='file' name='file' /></td>
    </tr>
    <tr>
    <td colspan='2' style='text-align: right;'><input type='submit'
    value='Submit' /></td>
    </tr>
    </table>
    </form> 
    </BODY>
    </HTML>
    PHP Code:
    <?php
    if ($HTTP_POST_FILES['file']['size'] < 50000)
    {
     
    move_uploaded_file($HTTP_POST_FILES['file']['tmp_name'],
    'uploads/' $HTTP_POST_FILES['file']['name']);
    echo 
    '&status=ok&';
    } else
    {
    echo 
    '&status=error&';
    }
    print 
    "<img src=\"uploads/" $HTTP_POST_FILES['file']['name'] . "\">";
    ?>
    So to sum it up I need an " on (release) " that will make the .jpg inside the "uploads/" folder to be loaded in flash automatically.

    Thanks in advance!
    la la la la laaaaaaa

  2. #2
    Registered User
    Join Date
    Feb 2001
    Posts
    13,041
    Hi,

    check out http://wolfgang.remsnet.de/gallery/admin.php (user image, pass upload)
    find source files here: http://www.flashkit.com/board/showth...hreadid=520841

    Musicman

  3. #3
    if(i>$){i=:);} falshdancer's Avatar
    Join Date
    Nov 2003
    Location
    NYC
    Posts
    546
    I can't get it to work? How do I use it? Do I have to change any permmissions or make a .swf, .txt, etc.?

    Thanks
    la la la la laaaaaaa

  4. #4
    Registered User
    Join Date
    Feb 2001
    Posts
    13,041
    Hi,

    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

    Musicman

  5. #5
    if(i>$){i=:);} falshdancer's Avatar
    Join Date
    Nov 2003
    Location
    NYC
    Posts
    546
    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:
    code:
    on (release) {
    getURL ("javascript:NewWindow=window.open('admin.php','ne wWin','width=400,height=300,left=0,top=0, toolbar=No,location=No,scrollbars=No,status=No,res izable=No,fullscreen=No'); NewWindow.focus(); void(0);");
    }


    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.

    Thanks!

    P.S. I'm a Flash designer and a musician too!
    la la la la laaaaaaa

  6. #6
    Registered User
    Join Date
    Feb 2001
    Posts
    13,041
    Hi,

    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.

    Musicman
    Attached Files Attached Files

  7. #7
    if(i>$){i=:);} falshdancer's Avatar
    Join Date
    Nov 2003
    Location
    NYC
    Posts
    546
    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?

    Thanks
    la la la la laaaaaaa

  8. #8
    Senior Member
    Join Date
    Nov 2003
    Location
    Las Vegas
    Posts
    770
    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).
    Attached Files Attached Files

  9. #9
    Registered User
    Join Date
    Feb 2001
    Posts
    13,041
    Hi,

    can you post or PM the actual url for a test?

    Musicman

  10. #10
    if(i>$){i=:);} falshdancer's Avatar
    Join Date
    Nov 2003
    Location
    NYC
    Posts
    546
    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
    )

    )
    What should I do?
    la la la la laaaaaaa

  11. #11
    Registered User
    Join Date
    Feb 2001
    Posts
    13,041
    Hi,

    I believe you should have an upload dir (probably a subdir of where your php file is located) with 777 permissions.

    Musicman

  12. #12
    if(i>$){i=:);} falshdancer's Avatar
    Join Date
    Nov 2003
    Location
    NYC
    Posts
    546
    OK got it. It works now,but it doesen't load the jpeg into flash? Do I need to add the upload.as actions into the flash file using #include;?
    Thanks!
    Last edited by falshdancer; 06-01-2004 at 03:39 PM.
    la la la la laaaaaaa

  13. #13
    Senior Member
    Join Date
    Nov 2003
    Location
    Las Vegas
    Posts
    770
    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.

  14. #14
    if(i>$){i=:);} falshdancer's Avatar
    Join Date
    Nov 2003
    Location
    NYC
    Posts
    546
    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.
    la la la la laaaaaaa

  15. #15
    Senior Member
    Join Date
    Nov 2003
    Location
    Las Vegas
    Posts
    770
    Here's a working example, but I will only leave it up for a few days, don't want a bunch of files uploaded to my server.

    http://jerryscript.hostrocket.com/fl.../loadjpeg.html

    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.

  16. #16
    if(i>$){i=:);} falshdancer's Avatar
    Join Date
    Nov 2003
    Location
    NYC
    Posts
    546
    I tried yours and it didn't work? Is it my Internet Explorer, or Mac stopping it from loading the image?

    Thanks again!
    la la la la laaaaaaa

  17. #17
    Registered User
    Join Date
    Feb 2001
    Posts
    13,041
    Hi,

    did you have any luck with my script?

    Musicman

  18. #18
    if(i>$){i=:);} falshdancer's Avatar
    Join Date
    Nov 2003
    Location
    NYC
    Posts
    546
    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.
    la la la la laaaaaaa

  19. #19
    Registered User
    Join Date
    Feb 2001
    Posts
    13,041
    Hi,

    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

    Musicman

  20. #20
    if(i>$){i=:);} falshdancer's Avatar
    Join Date
    Nov 2003
    Location
    NYC
    Posts
    546
    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.
    la la la la laaaaaaa

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center