????JFIF??x?x????'
| Server IP : 79.136.114.73 / Your IP : 216.73.216.57 Web Server : Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.29 OpenSSL/1.0.1f System : Linux b8009 3.13.0-170-generic #220-Ubuntu SMP Thu May 9 12:40:49 UTC 2019 x86_64 User : www-data ( 33) PHP Version : 5.5.9-1ubuntu4.29 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/appsrv.astacus.se/ap-interface/ |
Upload File : |
<?php
session_start();
if(!isset($_SESSION['ASTACUS_SSO_INFO']) ||
(trim($_SESSION['ASTACUS_SSO_INFO'])=='')){
header('location: index.php');
}
$file_param_name = 'file';
$file_name = $_GET['projectId'] ."_". $_GET['name'] ."_".date("Ymd-his"). ".zip";
$source_file_path = $_FILES[ $file_param_name ][ 'tmp_name' ];
$link = mysql_connect ("localhost", "root", "root123");
mysql_select_db ("vpa");
// List all folders
$sql = "SELECT * FROM Document, ProjectDocumentJoin WHERE Document.DocumentId = ProjectDocumentJoin.DocumentId and isFolder = 1 and ProjectDocumentJoin.ProjectId = ".$_GET['projectId']."";
$result = mysql_query($sql);
while ($row = mysql_fetch_assoc($result)){
$FolderName = $row['Name'];
if($FolderName == "Files from customer"){
$DocumentId = $row['DocumentId'];
$isFolderCreated = $row['isFolderCreated'];
}
}
// If there is no "Files to customer"-folder on filesystem, create "Files to customer"
if($isFolderCreated != 1){
$FolderToCreate = "/var/www/ap_files/".$_GET['projectId']."/projectdocuments/".$DocumentId;
mkdir("$FolderToCreate", 0777, true);
}
$target_file_path = "/var/www/ap_files/".$_GET['projectId']."/projectdocuments/".$DocumentId ."/". $file_name ;
// Import fileinfo in DB, and get DocumnetID for uploaded file.
$Documentsize = filesize($source_file_path);
$date = date("Y-m-d h:i:s");
$CreatedBySystemUserId = $_SESSION['ASTACUS_SSO_INFO'][0];
$FullPath = "/".$_GET['projectId']."/projectdocuments/".$DocumentId ."/". $file_name;
$sql = "call createNewDocument('$file_name', 'Uploaded trough AP-interface',$CreatedBySystemUserId, $Documentsize, '$FullPath', $DocumentId,".$_GET['projectId'].", '$date')";
mysql_query($sql);
echo($sql);
move_uploaded_file( $source_file_path, $target_file_path );
?>