Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Uploading a file using a php script while running application with LCDS

Avatar

Level 2
Hi! I developping an application under Flex 2 / Java -
running on LCDS / JRun server.



I'm trying to add uploading capabilities. I'm using a php
script for the upload part.



First, I just try to put script on the app directory. Doesn't
work.

After that I set up an apache server from where I put a small
web site with my script. It's telling me that my file is
succesfully uploaded, but I can't find the file. The apache log
give me no error.



Someone can help me?
1 Accepted Solution

Avatar

Correct answer by
Level 1
Originally, I had problems w/ the file being placed in
C:/whatever.ext b/c I wasn't using relative paths.



This is the code I use:

--------------------------------



$MAXIMUM_FILESIZE = 1024 * 1024 * 2; // 2MB

$newFileLoc = "./wherever/file.jpg"



if ($_FILES['Filedata']['size'] <= $MAXIMUM_FILESIZE) {





move_uploaded_file($_FILES['Filedata']['tmp_name'],
"./temporary/".$_FILES['Filedata']['name']);



rename( "./temporary/".$_FILES['Filedata']['name'],
$newFileLoc );

chmod( $newFileLoc, 0777 );



}



---------------------------



Modified from this article by Adobe:




http://livedocs.adobe.com/flex/201/html/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Book_...



View solution in original post

3 Replies

Avatar

Correct answer by
Level 1
Originally, I had problems w/ the file being placed in
C:/whatever.ext b/c I wasn't using relative paths.



This is the code I use:

--------------------------------



$MAXIMUM_FILESIZE = 1024 * 1024 * 2; // 2MB

$newFileLoc = "./wherever/file.jpg"



if ($_FILES['Filedata']['size'] <= $MAXIMUM_FILESIZE) {





move_uploaded_file($_FILES['Filedata']['tmp_name'],
"./temporary/".$_FILES['Filedata']['name']);



rename( "./temporary/".$_FILES['Filedata']['name'],
$newFileLoc );

chmod( $newFileLoc, 0777 );



}



---------------------------



Modified from this article by Adobe:




http://livedocs.adobe.com/flex/201/html/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Book_...



Avatar

Level 2
well! It's not working.



Is there a way to trace action in the apache log from php? To
trace the step perform in the code when invoking the upload
script.

Avatar

Level 2
Do I need a .htaccess in my folder. If yes with what
inside?