Phpmywind: how to modify the path of the upload server when uploading images to the server-php Tutorial

Source: Internet
Author: User
Phpmywind: where can I modify the path of the uploaded image to the server?
/*
**************************
(C) 2010-2014 phpMyWind.com
Update: 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 externally passed values and escape them
Function _ RunMagicQuotes (& $ svar)
{
// PHP5.4 has 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 ('The requested variable value is not allowed! ');
}

$ Svar = addslashes ($ svar );
}
}
Return $ svar;
}


// Directly apply variable name substitution
Foreach (array ('_ get',' _ Post') as $ _ request)
{
Foreach ($ _ request as $ _ k => $ _ v)
{
If (strlen ($ _ k)> 0 &&
Preg_match ('# ^ (GLOBALS | _ GET | _ POST | _ SESSION | _ COOKIE) #', $ _ k ))
{
Exit ('The requested variable name is not allowed! ');
}

$ {$ _ 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'); // introduce the database class


// Introduce the database class
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 storage path
$ Pai_image_dir = PHPMYWIND_UPLOAD;
// $ Export _soft_dir = PHPMYWIND_ROOT. '/upload ';
// $ Pai_media_dir = PHPMYWIND_ROOT. '/upload ';


// System version number
$ Pai_vernum = file_get_contents (PHPMYWIND_DATA. '/version/version.txt ');
$ Pai_vertime = file_get_contents (PHPMYWIND_DATA. '/version/vertime.txt ');


// Set the default time zone
If (PHP_VERSION> '5. 1 ')
{
$ Time51 = $ pai_timezone *-1;
@ Date_default_timezone_set ('etc/GMT'. $ time51 );
}


// Determine whether an error message is enabled
If ($ pai_diserror = 'y ')
Error_reporting (E_ALL );
Else
Error_reporting (0 );


// Determine the access device
// If you manually change the background Directory, change the/admin directory to the new background directory.
If (IsMobile ()&&! Strstr (GetCurUrl (), '4G. php ')&&
$ Pai_mobile = 'y '&&! Strstr (GetCurUrl (), '/admin '))
{
Header ('Location: 4G. php ');
}

?>


Reply to discussion (solution)

What is the value of PHPMYWIND_UPLOAD?

In common. inc. php
Define ('phpmywind _ upload', PHPMYWIND_ROOT. '/uploads ');
$ Pai_image_dir = PHPMYWIND_UPLOAD. '/image ';
$ Pai_soft_dir = PHPMYWIND_UPLOAD. '/soft ';
$ Pai_media_dir = PHPMYWIND_UPLOAD. '/media ';
So this is where it should be modified.

The upload. class. php 122 line
$ Save_url = 'uploads/'. $ upload_url.'/'. $ filename;
Ying writing
$ Save_url = basename (PHPMYWIND_UPLOAD). '/'. $ upload_url. '/'. $ filename;
In order 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.