A Flash Developer Resource Site

Results 1 to 7 of 7

Thread: FileReference.upload method, extra variable?

  1. #1
    Senior Member Boombanguk's Avatar
    Join Date
    Jun 2000
    Posts
    1,194

    FileReference.upload method, extra variable?

    hi,

    im using the FileReference.upload method to upload a file to a php script, only thing is I want to also an extra variable (the directory where the file is to be put) to the php script, but don't see how to include that, how do I do that?

    thanks for any advice.
    boombanguk

  2. #2
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    PHP Code:
    //path to folder
    $folder'text';

    //path name of file for storage
    $uploadfile "$folder/" basename$_FILES['Filedata']['name'] );

    //if the file is moved successfully
    if ( move_uploaded_file$_FILES['Filedata']['tmp_name'] , $uploadfile ) ) {
     
    success("The file was successfully uploaded.");

    - The right of the People to create Flash movies shall not be infringed. -

  3. #3
    Senior Member Boombanguk's Avatar
    Join Date
    Jun 2000
    Posts
    1,194
    thats php code right? what I need is how do I send that $folder variable FROM flash to the php code when I do the upload comand?

  4. #4
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    You can't. You need to do it over php. Flash will put your file where the movie is located.
    - The right of the People to create Flash movies shall not be infringed. -

  5. #5
    Bearded (M|G)od MyFriendIsATaco's Avatar
    Join Date
    Dec 2002
    Location
    Awesomeville.
    Posts
    3,045
    you could always append the folder name to the end of the upload method like so:

    FileReference.upload("myscript.php?folder=/folder1/folder2/");

    then in PHP, use the $_GET['folder'] to retrieve that folder information.

  6. #6
    Senior Member Boombanguk's Avatar
    Join Date
    Jun 2000
    Posts
    1,194
    Quote Originally Posted by cancerinform
    You can't. You need to do it over php. Flash will put your file where the movie is located.
    I probably didn't explain myself well, as I just did "upload.php?file=whatever" and it worked fine. But I was hoping I could send a variable actually from WITHIN flash with the upload method. That seems to me a bit of a miss from adobe, as what if I need to send variables with the upload (and I don't want to use ?file=).....thats what I love about loadVars.

  7. #7
    Senior Member cancerinform's Avatar
    Join Date
    Mar 2002
    Location
    press the picture...
    Posts
    13,449
    MyFriendIsATaco gave you the best solution, did not know it

    You cannot send anything using LoadVars to the php file.
    - The right of the People to create Flash movies shall not be infringed. -

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