| Server IP : 51.222.109.124 / Your IP : 216.73.217.148 Web Server : Apache System : Linux scl07net.netdom.salvador.br 3.10.0-962.3.2.lve1.5.44.3.el7.x86_64 #1 SMP Mon Feb 22 04:35:33 EST 2021 x86_64 User : vertra94 ( 1153) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/vertra94/public_html/loja/app/helpers/redactor/ |
Upload File : |
<?php
function get_current_url()
{
$protocol = 'http';
if ( $_SERVER['SERVER_PORT'] == 443 || (!empty( $_SERVER['HTTPS'] ) && $_SERVER['HTTPS'] == 'on') )
{
$protocol .= 's';
$protocol_port = $_SERVER['SERVER_PORT'];
}
else
{
$protocol_port = 80;
}
$host = $_SERVER['HTTP_HOST'];
$port = $_SERVER['SERVER_PORT'];
$request = $_SERVER['PHP_SELF'];
if ( isset( $_SERVER['argv'][0] ) )
$query = substr( $_SERVER['argv'][0], strpos( $_SERVER['argv'][0], ';' ) + 1 );
$toret = $protocol . '://' . $host . ($port == $protocol_port ? '' : ':' . $port) . $request . (empty( $query ) ? '' : '?' . $query);
return $toret;
}
if ( !preg_match( '/www/', get_current_url() ) )
{
$protocol = "http://";
}
else
{
$protocol = 'http://www.';
}
$url = explode( "/helpers", get_current_url() );
$httpurl = $url[0] . "/userfiles";
// files storage folder
$dir = '../../userfiles/';
$_FILES['file']['type'] = strtolower( $_FILES['file']['type'] );
if ( $_FILES['file']['type'] == 'image/png'
|| $_FILES['file']['type'] == 'image/jpg'
|| $_FILES['file']['type'] == 'image/gif'
|| $_FILES['file']['type'] == 'image/jpeg'
|| $_FILES['file']['type'] == 'image/pjpeg' )
{
// setting file's mysterious name
//$file = $dir.md5(date('YmdHis')).'.jpg';
$file = $dir . $_FILES['file']['name'];
$filename = $_FILES['file']['name'];
// copying
copy( $_FILES['file']['tmp_name'], $file );
// displaying file
$array = array(
'filelink' => $httpurl . "/" . $filename
);
echo stripslashes( json_encode( $array ) );
}
?>