'File is the wrong size'); } return array('success'=>true); } /** * Handles the upload where content type is "multipart/form-data" * @param $uploadDirectory {String} the path to upload to * @param $replaceOldFile {Boolean} whether to replace existing files */ public static function handleMultipartFormdata($uploadDirectory, $replaceOldFile) { error_log("hello, count()=" . $_FILES.count()); foreach ($_FILES as $file) { error_log("$file=" . $file); $filename = QxUploadMgr::getFilename($uploadDirectory, $file['name'], $replaceOldFile); error_log("Receiving multipart/formdata into $filename"); if (!move_uploaded_file($file['tmp_name'], $filename)) { error_log("Failed to move uploaded file from ". $file['tmp_name']. " to $filename"); return array('error' => 'Failed to move uploaded file'); } } return array('success'=>true); } } $result = QxUploadMgr::handleUpload('uploads'); // to pass data through iframe you will need to encode all html tags echo htmlspecialchars(json_encode($result), ENT_NOQUOTES);