Qual: Utilise fonction commune pour uplaod document
This commit is contained in:
parent
61fafc43f4
commit
2869d451e6
@ -96,11 +96,6 @@ llxHeader();
|
|||||||
|
|
||||||
if ($_GET["id"] > 0)
|
if ($_GET["id"] > 0)
|
||||||
{
|
{
|
||||||
if ( $error_msg )
|
|
||||||
{
|
|
||||||
echo '<div class="error">'.$error_msg.'</div><br>';
|
|
||||||
}
|
|
||||||
|
|
||||||
$act = new ActionComm($db);
|
$act = new ActionComm($db);
|
||||||
$act->fetch($_GET["id"]);
|
$act->fetch($_GET["id"]);
|
||||||
$res=$act->societe->fetch($act->societe->id);
|
$res=$act->societe->fetch($act->societe->id);
|
||||||
@ -190,44 +185,29 @@ if ($_GET["id"] > 0)
|
|||||||
|
|
||||||
print '</div>';
|
print '</div>';
|
||||||
|
|
||||||
|
if ($mesg) { print $mesg."<br>"; }
|
||||||
|
|
||||||
// Affiche formulaire upload
|
// Affiche formulaire upload
|
||||||
if ($conf->upload)
|
$html=new Form($db);
|
||||||
{
|
$html->form_attach_new_file('document.php?id='.$act->id);
|
||||||
print_titre($langs->trans('AttachANewFile'));
|
|
||||||
|
|
||||||
print '<form name="userfile" action="document.php?id='.$act->id.'" enctype="multipart/form-data" method="POST">';
|
// Affiche liste des documents existant
|
||||||
|
print_titre($langs->trans("AttachedFiles"));
|
||||||
print '<table class="noborder" width="100%">';
|
|
||||||
print '<tr><td width="50%" valign="top">';
|
|
||||||
|
|
||||||
print '<input type="hidden" name="max_file_size" value="'.$conf->maxfilesize.'">';
|
|
||||||
print '<input class="flat" type="file" name="userfile" size="80">';
|
|
||||||
print ' ';
|
|
||||||
print '<input type="submit" class="button" value="'.$langs->trans("Add").'" name="sendit">';
|
|
||||||
|
|
||||||
print "</td></tr>";
|
|
||||||
print "</table>";
|
|
||||||
|
|
||||||
print '</form>';
|
|
||||||
print '<br>';
|
|
||||||
}
|
|
||||||
|
|
||||||
$errorlevel=error_reporting();
|
|
||||||
error_reporting(0);
|
|
||||||
$handle=opendir($upload_dir);
|
|
||||||
error_reporting($errorlevel);
|
|
||||||
|
|
||||||
print '<table width="100%" class="noborder">';
|
print '<table width="100%" class="noborder">';
|
||||||
|
|
||||||
if ($handle)
|
|
||||||
{
|
|
||||||
print '<tr class="liste_titre">';
|
print '<tr class="liste_titre">';
|
||||||
print '<td>'.$langs->trans('Document').'</td>';
|
print '<td>'.$langs->trans('Document').'</td>';
|
||||||
print '<td align="right">'.$langs->trans('Size').'</td>';
|
print '<td align="right">'.$langs->trans('Size').'</td>';
|
||||||
print '<td align="center">'.$langs->trans('Date').'</td>';
|
print '<td align="center">'.$langs->trans('Date').'</td>';
|
||||||
print '<td> </td>';
|
print '<td> </td>';
|
||||||
print '</tr>';
|
print '</tr>';
|
||||||
|
|
||||||
|
if (is_dir($upload_dir))
|
||||||
|
{
|
||||||
|
$errorlevel=error_reporting();
|
||||||
|
$handle=opendir($upload_dir);
|
||||||
|
if ($handle)
|
||||||
|
{
|
||||||
$var=true;
|
$var=true;
|
||||||
while (($file = readdir($handle))!==false)
|
while (($file = readdir($handle))!==false)
|
||||||
{
|
{
|
||||||
@ -247,9 +227,12 @@ if ($_GET["id"] > 0)
|
|||||||
}
|
}
|
||||||
closedir($handle);
|
closedir($handle);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<div class="error">'.$langs->trans('ErrorCantOpenDir').'<b> '.$upload_dir.'</b></div>';
|
||||||
|
}
|
||||||
|
}
|
||||||
print '</table>';
|
print '</table>';
|
||||||
|
|
||||||
print '</div>';
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user