Jump to:

23486 Posts in 18995 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » Problems with AS3 Fileupload & move_uploaded_file()

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 1367 Views
  • Kago
    Community Member
    2 Posts

    Problems with AS3 Fileupload & move_uploaded_file() Link to this post

    Hi All,

    I'm new to Silverstripe, working mainly Flash AS3 programming and have a little PHP experience. At the moment i try to make my way with frontend completly in Flash, the backend in Silverstripe. I want to make a fileupload for users and worked out the tutorials - now I'm at the point to replace the Blackberry HTML-Frontend with Flashfrontend. The problem now is, that i can't use move_uploaded_file in mysite/code. I tried my Flashscript with a simple moveto-php file that i located in the toplevel of my installation. That works fine. When I call my Class and function like:

    I get my information in

    $_FILES["Filedata"]["tmp_name"] and

    from the temporary file uploaded via Flash Filereference. But move_uploade_file does not work. I assume that this has to do with right-settings, i also have read about problems with open_basedir, but that does not bring light to me.
    I created a

    _ss_enviroment.php define('TEMP_FOLDER', dirname(getcwd())."/tmp");

    and a tmp-Folder - because I read a thread about some simular problems where this helped.

    Can anyone help?

    Im using: local insatllation on a Mac with Mamp, Silverstripe 2.4.3
    Is there a special place for Flash/AS3 Posts?

    Lot's of greetings and thanks in advance for your help and all the great work on silverstripe.


  • Kago
    Community Member
    2 Posts

    Re: Problems with AS3 Fileupload & move_uploaded_file() Link to this post

    The fix is: I've used move_uploaded_file wrong...
    When I check the folder the php-classes are located using "echo getcwd();" I get the "sapphire" - folder. I used move_uploaded_file ( string $filename , "mysite/code" ) instead of move_uploaded_file ( string $filename , "sapphire" ). I think this is very basic error... but I'm still at the beginning:-)

    Now the working code moving the tmp-File to the asset folder in my class looks like this:

    if (isset($tmpFile) && is_uploaded_file($tmpFile["tmp_name"])) {
    $file = new PDF_File();
    $upload = new Upload();
    $dir = "../assets/pdfUpload";
    $upload->loadIntoFile($tmpFile, $file, $dir);


Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.