Menu

[r9]: / projects_site / uploadfile.php  Maximize  Restore  History

Download this file

147 lines (123 with data), 4.1 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
<?php
/*
** Application name: phpCollab
** Last Edit page: 26/01/2004
** Path by root: ../project_site/uploadfile.php
** Authors: Ceam / Fullo / Shaders
**
** =============================================================================
**
** phpCollab - Project Managment
**
** -----------------------------------------------------------------------------
** Please refer to license, copyright, and credits in README.TXT
**
** -----------------------------------------------------------------------------
** FILE: uploadfile.php
**
** DESC: Screen: notification class
**
** HISTORY:
** 26/01/2004 - added file notification
** 18/02/2005 - added fix for php 4.3.11 and removed spaces from name
** -----------------------------------------------------------------------------
** TO-DO:
**
**
** =============================================================================
*/
$checkSession = "true";
include("../includes/library.php");
if ($action == "add")
{
$filename = check_FileName($_FILES['upload']['name']);
if ($maxCustom != "")
{
$maxFileSize = $maxCustom;
}
if ($_FILES['upload']['size']!=0)
{
$taille_ko=$_FILES['upload']['size']/1024;
}
else
{
$taille_ko=0;
}
if ($filename == "")
{
$error.=$strings["no_file"]."<br/>";
}
if ($_FILES['upload']['size']>$maxFileSize)
{
if($maxFileSize!=0)
{
$taille_max_ko=$maxFileSize/1024;
}
$error.=$strings["exceed_size"]." ($taille_max_ko $byteUnits[1])<br/>";
}
$extension= strtolower( substr( strrchr($filename, ".") ,1) );
if ($allowPhp == "false")
{
$send = "";
if ($filename != "" && ($extension=="php" || $extension=="php3" || $extension=="phtml")) {
$error.=$strings["no_php"]."<br/>";
$send = "false";
}
}
if ($filename != "" && $_FILES['upload']['size']<$maxFileSize && $_FILES['upload']['size'] != 0 && $send != "false")
{
$docopy = "true";
}
if ($docopy == "true")
{
$commentsField = convertData($commentsField);
$tmpquery = "INSERT INTO ".$tableCollab["files"]."(owner,project,task,comments,upload,published,status,vc_version,vc_parent,phase) VALUES('$idSession','$projectSession','0','$commentsField','$dateheure','0','2','0.0','0','0')";
connectSql("$tmpquery");
$tmpquery = $tableCollab["files"];
last_id($tmpquery);
$num = $lastId[0];
unset($lastId);
if ($notifications == "true")
{
include("../projects_site/noti_uploadfile.php");
}
uploadFile("files/$project", $_FILES['upload']['tmp_name'], "$num--".$filename);
$size = file_info_size("../files/".$project."/".$num."--".$filename);
//$dateFile = file_info_date("files/".$project."/".$num."--".$filename);
$chaine = strrev("../files/".$project."/".$num."--".$filename);
$tab = explode(".",$chaine);
$extension = strtolower(strrev($tab[0]));
$name = $num."--".$filename;
$tmpquery = "UPDATE ".$tableCollab["files"]." SET name='$name',date='$dateheure',size='$size',extension='$extension' WHERE id = '$num'";
connectSql("$tmpquery");
headerFunction("doclists.php?".session_name()."=".session_id());
exit;
}
}
$bouton[4] = "over";
$titlePage = $strings["upload_file"];
include ("include_header.php");
echo "
<form accept-charset='UNKNOWN' method='POST' action='../projects_site/uploadfile.php?".session_name()."=".session_id()."&action=add&project=$projectSession&task=$task#filedetailsAnchor' name='feeedback' enctype='multipart/form-data'>
<input type='hidden' name='MAX_FILE_SIZE' value='100000000'>
<input type='hidden' name='maxCustom' value='".$projectDetail->pro_upload_max[0]."'>
<table cellpadding='3' cellspacing='0' border='0'>
<tr>
<th colspan='2'>".$strings["upload_form"]."</th>
</tr>
<tr>
<th>".$strings["comments"]." :</th>
<td><textarea cols='60' name='commentsField' rows='6'>$commentsField</textarea></td>
</tr>
<tr>
<th>".$strings["upload"]." :</th>
<td><input size='35' value='' name='upload' type='file'></td>
</tr>
<tr>
<th>&nbsp;</th>
<td><input name='submit' type='submit' value='".$strings["save"]."'><br/><br/>$error</td>
</tr>
</table>
</form>";
include ("include_footer.php");
?>
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.