Phpmywind upload image to server where to modify the path of the upload server

Source: Internet
Author: User
/*
**************************
(C) 2010-2014 phpmywind.com
Update:2012-8-28 13:47:05
Person:feng
**************************
*/

Define (' Phpmywind_inc ', Preg_replace ("/[\/\\\\]{1,}/", '/', dirname (__file__)));
Define (' Phpmywind_root ', Preg_replace ("/[\/\\\\]{1,}/", '/', substr (phpmywind_inc, 0,-8)));

Define (' Phpmywind_data ', phpmywind_root. /data ');
Define (' Phpmywind_temp ', phpmywind_root. /templates ');
Define (' Phpmywind_upload ', phpmywind_root. /upload ');

Define (' Phpmywind_backup ', Phpmywind_data. /backup ');
Define (' In_phpmywind ', TRUE);


Check for externally passed values and escape
Function _runmagicquotes (& $svar)
{
PHP5.4 already removed this function
if (@!get_magic_quotes_gpc ())
{
if (Is_array ($svar))
{
foreach ($svar as $_k = $_v) $svar [$_k] = _runmagicquotes ($_V);
}
Else
{
if (strlen ($svar) >0 &&
Preg_match (' #^ (cfg_| Globals|_get|_post|_session|_cookie) # ', $svar))
{
Exit (' Do not allow the requested variable value! ');
}

$svar = Addslashes ($svar);
}
}
return $svar;
}


Directly apply variable name overrides
foreach (Array (' _get ', ' _post ') as $_request)
{
foreach ($$_request as $_k = $_v)
{
if (strlen ($_k) >0 &&
Preg_match (' #^ (globals|_get|_post|_session|_cookie) # ', $_k))
{
Exit (' Do not allow the requested variable name! ');
}

${$_k} = _runmagicquotes ($_v);
}
}


Require_once (phpmywind_inc. '/config.cache.php '); Global configuration file
Require_once (phpmywind_inc. '/common.func.php '); Global common functions
Require_once (phpmywind_inc. '/conn.inc.php '); Introducing Database Classes


Introducing Database Classes
if ($cfg _mysql_type = = ' Mysqli ' &&
Function_exists (' Mysqli_init '))
Require_once (phpmywind_inc. '/mysqli.class.php ');
Else
Require_once (phpmywind_inc. '/mysql.class.php ');


Session Save Path
$sess _savepath = phpmywind_data. ' /sessions/';
if (is_writable ($sess _savepath) &&
Is_readable ($sess _savepath))
Session_save_path ($sess _savepath);


Upload File Save path
$cfg _image_dir = phpmywind_upload;
$cfg _soft_dir = phpmywind_root. ' /upload ';
$cfg _media_dir = phpmywind_root. ' /upload ';


System version number
$cfg _vernum = file_get_contents (phpmywind_data. ') /version/version.txt ');
$cfg _vertime = file_get_contents (phpmywind_data. ') /version/vertime.txt ');


Set the default time zone
if (php_version > ' 5.1 ')
{
$time Wuyi = $cfg _timezone *-1;
@date_default_timezone_set (' Etc/gmt '. $time 51);
}


To determine whether to turn on the error prompt
if ($cfg _diserror = = ' Y ')
Error_reporting (E_all);
Else
error_reporting (0);


Judging access devices
If you manually change the background directory, change the/admin directory to a new background directory
if (IsMobile () &&!strstr (Getcururl (), ' 4g.php ') &&
$cfg _mobile== ' Y ' &&!strstr (Getcururl (), '/admin '))
{
Header (' location:4g.php ');
}

?>


Reply to discussion (solution)

What is the value of Phpmywind_upload?

There are common.inc.php in the
Define (' Phpmywind_upload ', phpmywind_root. /uploads ');
$cfg _image_dir = phpmywind_upload. ' /image ';
$cfg _soft_dir = phpmywind_upload. ' /soft ';
$cfg _media_dir = phpmywind_upload. ' /media ';
So this is where it's supposed to change.

and upload.class.php 122 lines of
$save _url = ' uploads/'. $upload _url. ' /'. $filename;
Should write
$save _url = basename (phpmywind_upload). '/'. $upload _url. ' /'. $filename;
To ensure that the physical path and URL path are consistent

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.