Jump to content

Display uploaded files (change link)


the magus

Recommended Posts

Hello everybody

 

I am using a very simple PHP upload script..

 

and I have 2 domains... domain1.com & domain2.com

 

domain1.com is the main domain which is linked to the root. While domain2.com is linked to a folder ("up"  for example) inside public_html

 

I am using my php upload script on domain2.com.

 

After uploading files script displays the link of the uploaded files as this:

 

h ttp:// www .domain1. com /up/ uploaded/ image.jpg

 

WHAT I WANT is to make the script display domain2.com not the main domain which is linked to the root.

 

i.e i want to make the link as this (h ttp:// www .domain2 .com/ uploaded/image.jpg

 

and here is the code:

 

include_once("header.php");
// load main switch if constant pass is defined
if(defined("DODOUPLOADOK")) {
    switch($action) {
        case "uploadmulti_upload":
        case "upload":
            $uploaded_files = handle_uploaded_files("userfile");
            if(empty($uploaded_files)) {
                print_error("عملية خاطئة", "لم تقم تقم برفع أي ملف أو ملفات");
            } else {
                $error = uploadfiles_error_checking($uploaded_files, $userpath, $MAX_FILE_SIZE, $dim_requirement, $require_exact_dim, $filename_limit, $require_file_type);
                if($error !== true)
                    print_error("Error", $error);
                else {
                    $output = upload_files($uploaded_files, $userpath);
                    print_error("تم تحميل الملف بنجاح", "رابط الملف الذي تم تحميلة.<br /><br />".$output, "العودة للملفات ", $_SERVER['PHP_SELF']);
                    display_upload_form();
                }

 

 

and I think the problem is here:

 

                    $output = upload_files($uploaded_files, $userpath);
                     print_error("تم تحميل الملف بنجاح", "رابط الملف الذي تم تحميلة.<br /><br />".$output, "العودة للملفات ", $_SERVER['PHP_SELF']);
                     display_upload_form();
                 }

 

 

I hope I could cleared my point.

 

 

Thanks in advance

 

 

Link to comment
https://forums.phpfreaks.com/topic/172715-display-uploaded-files-change-link/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.