BUG 4314 Adjustment to uploading photos and Resumes.

This commit is contained in:
Hector Cortez
2011-12-07 09:50:42 -04:00
committed by Erik Amaru Ortiz
parent 11a2f1f6fc
commit 0f2cb538b2
7 changed files with 55 additions and 9 deletions

View File

@@ -125,6 +125,21 @@ try {
'USER_FULLNAME' => $infoUser
);
}
//calculating the max upload file size;
$POST_MAX_SIZE = ini_get('post_max_size');
$mul = substr($POST_MAX_SIZE, -1);
$mul = ($mul == 'M' ? 1048576 : ($mul == 'K' ? 1024 : ($mul == 'G' ? 1073741824 : 1)));
$postMaxSize = (int)$POST_MAX_SIZE * $mul;
$UPLOAD_MAX_SIZE = ini_get('upload_max_filesize');
$mul = substr($UPLOAD_MAX_SIZE, -1);
$mul = ($mul == 'M' ? 1048576 : ($mul == 'K' ? 1024 : ($mul == 'G' ? 1073741824 : 1)));
$uploadMaxSize = (int)$UPLOAD_MAX_SIZE * $mul;
if ( $postMaxSize < $uploadMaxSize ) $uploadMaxSize = $postMaxSize;
$aFields['MAX_FILES_SIZE'] = $uploadMaxSize . " (" . $UPLOAD_MAX_SIZE . ") ";
//print_r($aUserInfo);
global $_DBArray;
$_DBArray['aUserInfo'] = $aUserInfo;

View File

@@ -38,6 +38,20 @@ try {
$aFields['END_DATE'] = date('Y-m-d', mktime(0, 0, 0, date('m'), date('d'), date('Y') + 5));
$aFields['USR_DUE_DATE']= date('Y-m-d', mktime(0, 0, 0, date('m'), date('d'), date('Y') + 1));
//calculating the max upload file size;
$POST_MAX_SIZE = ini_get('post_max_size');
$mul = substr($POST_MAX_SIZE, -1);
$mul = ($mul == 'M' ? 1048576 : ($mul == 'K' ? 1024 : ($mul == 'G' ? 1073741824 : 1)));
$postMaxSize = (int)$POST_MAX_SIZE * $mul;
$UPLOAD_MAX_SIZE = ini_get('upload_max_filesize');
$mul = substr($UPLOAD_MAX_SIZE, -1);
$mul = ($mul == 'M' ? 1048576 : ($mul == 'K' ? 1024 : ($mul == 'G' ? 1073741824 : 1)));
$uploadMaxSize = (int)$UPLOAD_MAX_SIZE * $mul;
if ( $postMaxSize < $uploadMaxSize ) $uploadMaxSize = $postMaxSize;
$aFields['MAX_FILES_SIZE'] = $uploadMaxSize . " (" . $UPLOAD_MAX_SIZE . ") ";
//Load Calendar options and falue for this user
G::LoadClass ( 'calendar' );
$calendar = new Calendar ( );

View File

@@ -40,7 +40,10 @@ try {
break;
}
if ( empty($_POST) || !isset($_POST['form'])) {
throw ( new Exception ('Posted data is empty!') );
if( empty($_FILES) )
throw ( new Exception (G::loadTranslation('ID_ERROR_UPLOADING_FILENAME') ) );
else
throw ( new Exception (G::loadTranslation('ID_POSTED_DATA_EMPTY') ) );
}
$form = $_POST['form'];
@@ -290,5 +293,5 @@ catch (Exception $e) {
$aMessage['MESSAGE'] = $e->getMessage();
$G_PUBLISH = new Publisher;
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage );
G::RenderPage( 'publish');
G::RenderPage( 'publish', 'blank');
}

View File

@@ -1,5 +1,5 @@
<form id="{$form_id}" name="{$form_name}" action="{$form_action}" class="{$form_className}" method="post" encType="multipart/form-data" style="margin:0px;" onsubmit='return validateForm("{$form_objectRequiredFields}".parseJSON());'>
<div class="borderForm" style="padding-left: 0pt; padding-right: 0pt; width:70%">
<div class="borderForm" style="padding-left: 0pt; padding-right: 0pt; width:80%">
<div class="boxTop"><div class="a"></div><div class="b"></div><div class="c"></div></div>
<div class="content" style="">
<table width="99%">
@@ -29,7 +29,11 @@
<!-- <td class='FormFieldContent' width="{$form_width}" >{$form.USR_RESUME} </td> //-->
<td class="FormFieldContent" width="{$form_fieldContentWidth}">{$form.USR_RESUME}</td>
</tr>
<tr>
<tr>
<td class="FormLabel" width="{$form_labelWidth}">{$MAX_FILES_SIZE}</td>
<td class="FormFieldContent" width="{$form_fieldContentWidth}">{$form.MAX_FILES_SIZE}</td>
</tr>
<tr>
<td class="FormTitle" colspan="2" align="">{$form.TITLE1}</td>
</tr>
<tr>

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<dynaForm name="myInfo" width="70%" labelWidth="300px" mode="edit" enableTemplate="1">
<dynaForm name="myInfo" width="80%" labelWidth="350px" mode="edit" enableTemplate="1">
<menuUser type="xmlmenu" xmlfile="users/users_EditOptions"/>
<START_DATE type="phpVariable"/>
<END_DATE type="phpVariable"/>
@@ -16,6 +16,9 @@
<USR_RESUME type="file" group="1">
<en>Résumé</en>
</USR_RESUME>
<MAX_FILES_SIZE type="edit" mode="view">
<en>Max upload files size in bytes</en>
</MAX_FILES_SIZE>
<TITLE1 type="title" group="1">
<en>Personal Information</en>
</TITLE1>

View File

@@ -1,5 +1,5 @@
<form id="{$form_id}" name="{$form_name}" action="{$form_action}" class="{$form_className}" method="post" encType="multipart/form-data" style="margin:0px;" onsubmit='return validateForm("{$form_objectRequiredFields}".parseJSON());' >
<div class="borderForm" style="padding-left: 0pt; padding-right: 0pt; width:70%" >
<div class="borderForm" style="padding-left: 0pt; padding-right: 0pt; width:80%" >
<div class="boxTop"><div class="a"></div><div class="b"></div><div class="c"></div></div>
<div class="content" style="">
<table width="99%">
@@ -24,9 +24,13 @@
<!-- <td class='FormFieldContent' width="{$form_width}" >{$form.USR_RESUME} </td> //-->
<td class="FormFieldContent" width="{$form_fieldContentWidth}">{$form.USR_RESUME}</td>
</tr>
<tr>
<tr>
<td class="FormLabel" width="{$form_labelWidth}">{$MAX_FILES_SIZE}</td>
<td class="FormFieldContent" width="{$form_fieldContentWidth}">{$form.MAX_FILES_SIZE}</td>
</tr>
<tr>
<td class="FormTitle" colspan="2" align="">{$form.TITLE1}</td>
</tr>
</tr>
<tr>
<td class="FormLabel" width="{$form_labelWidth}"><font color="red">* </font>{$USR_FIRSTNAME}</td>
<!-- <td class='FormFieldContent' width="{$form_width}" >{$form.USR_FIRSTNAME} </td> //-->

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<dynaForm name="myInfo" width="70%" labelWidth="300px" mode="edit" enableTemplate="1">
<dynaForm name="myInfo" width="80%" labelWidth="350px" mode="edit" enableTemplate="1">
<menuUser type="xmlmenu" xmlfile="users/users_NewOptions">
<en/>
</menuUser>
@@ -15,6 +15,9 @@
<USR_RESUME type="file" group="1">
<en>Résumé</en>
</USR_RESUME>
<MAX_FILES_SIZE type="edit" mode="view">
<en>Max upload files size in bytes</en>
</MAX_FILES_SIZE>
<TITLE1 type="title" group="1">
<en>Personal Information</en>
</TITLE1>