I want to append the name of the file which has been uploaded using the $_POST method to post the $_FILES[\'fileImage\'][\'name\'] from the php script.
$_POST
$_FILES[\'fileImage\'][\'name\']
Because you're looking in $_POST for a variable which is in $_SESSION. Try changing it to:
$_SESSION
$output = array(); if(isset($_SESSION['fileImage'])){ $idx = count($_SESSION['fileImage']) -1 ; $output[] = isset($_SESSION['fileImage'][$idx]) ? $_SESSION['fileImage'][$idx]['name'] : ""; }