Jump to content

emailing uploaded files links


MsKazza
Go to solution Solved by fastsol,

Recommended Posts

Hi, I have the attached page that uploads files to the server and then emails the intended recipient, however I can't figure out how to include the link to the uploaded files.

 

Everything else works just fine, so any help on this would be much appreciated.

 

thanks,

 

MsKazza

 

P.s.  if anyone could point me in the direction of how to make my upload section like the attach files portion of these forum posts would love to upgrade mine. thanks.

index.php

Link to comment
Share on other sites

  • Solution

In this block

else{ // No error found! Move uploaded files 
	            if(move_uploaded_file($_FILES["files"]["tmp_name"][$f], $path.$name))
	            $count++; // Number of successfully uploaded file
	        }

Add {} to your if(), then make an array to store all the $path.$name that are moved.  Then below use a foreach to build an actual full path link to each file and insert it into the email where you want.

$moved_files = array();

else{ // No error found! Move uploaded files 
	            if(move_uploaded_file($_FILES["files"]["tmp_name"][$f], $path.$name))
                    {
	                $count++; // Number of successfully uploaded file
                        $moved_files[] = $path.$name;
                    }
	        }

$full_paths = '';
$domain_path = 'http://domain.com/';

foreach($moved_files as $m)
{
    $full_paths .= $domain_path.$m."\n\n";
}

$message = "Please find below links to file transfer from  : " . $from . "(" . $from_email . ") \n\n  The following message was included with the files : "  . $comment . "\n\n  Links here : " . $full_paths . "\n\n Regards Adlantic Team ";

That should get you started.

Link to comment
Share on other sites

Thank you both for your replies.

 

ginerjm - I did put my code in the attached file.  Is that not why there is the option to attach a file?

 

fastsol - Thank you so much that was great, worked a charm, now all i have to do is try make it drag and drop file upload :)

 

MsKazza

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.