Expand my Community achievements bar.

Adobe Summit 2025: AEM Session Recordings Are Live! Missed a session or want to revisit your favorites? Watch the latest recordings now.

Mark Solution

This conversation has been locked due to inactivity. Please create a new post.

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
Former Community Member
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
Former Community Member
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?
The following has evaluated to null or missing: ==> liqladmin("SELECT id, value FROM metrics WHERE id = 'net_accepted_solutions' and user.id = '${acceptedAnswer.author.id}'").data.items [in template "analytics-container" at line 83, column 41] ---- Tip: It's the step after the last dot that caused this error, not those before it. ---- Tip: If the failing expression is known to be legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)?? ---- ---- FTL stack trace ("~" means nesting-related): - Failed at: #assign answerAuthorNetSolutions = li... [in template "analytics-container" at line 83, column 5] ----