Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

General Questions /

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

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

Problems with AS3 Fileupload & move_uploaded_file()

Go to End

2 Posts   1869 Views


Community Member, 2 Posts

18 March 2011 at 1:46am

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.



Community Member, 2 Posts

18 March 2011 at 9:27pm

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);