PHP upload increased domain name

Source: Internet
Author: User
PHP Upload Add domain name
function Ajaxfile () {
foreach (lib_request:: $files as $filename = + $value) {
$picname = lib_request:: $files [$filename] [' name '];
$picsize = lib_request:: $files [$filename] [' size '];
if ($picname! = "") {
if ($picsize > 1024000) {
echo Json_encode (Array (
' Code ' = '-1 ',
' title ' = ' picture upload ',
' msg ' = ' picture size cannot exceed 1M '
));
Exit ();
}
$type = Get_extension ($picname);
if ($type! = "gif" && $type! = "jpg" && $type! = "JPEG" && $type! = "png") {
echo Json_encode (Array (
' Code ' = '-1 ',
' title ' = ' picture upload ',
' msg ' = ' picture is not in the right format! '
));
Exit ();
}
$upload _path = '/up ';

$rand = rand (100, 999);
$pics = Date ("Ymdhis"). $rand. '.' . $type;
$dir = Date ('/ymdh/');
$pic _path = $upload _path. $dir;
$pic _url = $pic _path. $pics;
if (!file_exists (path_root. $pic _path)) {
Creatfolder (path_root. $pic _path);
}
$PATH _root = Path_root. $pic _url;
Move_uploaded_file (lib_request:: $files [$filename] [' tmp_name '], $pic _path);
if (Request (' type ') = = ' goods ') {
Makethumbnail ($pic _path, $pic _path. ' _290x290.jpg ', 290, 190);
}
}
$arr [$filename] = Array (
' Name ' = $picname,
' Pic ' = $pic _url,
' Size ' = $picsize
);
}
echo Json_encode ($arr);
Exit ();
}





The path obtained after uploading is/up/xxxxx/xxxxx.jpg
I would like to change to: http://www.xxxx.com//up/xxxxx/xxxxx.jpg


------to solve the idea----------------------
An estimate is to want a change URL?


$pic _url = ' http://www.xxxx.com/'. $pic _path. $pics;



Is that so? The question is not clear haha.
------to solve the idea----------------------
What do you mean by that? I don't understand.
If it's the path inside the database, you can update it.
If it is uploaded to a different server, this should not be
  • 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.