MsKazza Posted February 23, 2016 Share Posted February 23, 2016 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 Quote Link to comment https://forums.phpfreaks.com/topic/300864-emailing-uploaded-files-links/ Share on other sites More sharing options...
ginerjm Posted February 23, 2016 Share Posted February 23, 2016 Again - people usually post their Pertinent code here. Quote Link to comment https://forums.phpfreaks.com/topic/300864-emailing-uploaded-files-links/#findComment-1531369 Share on other sites More sharing options...
Solution fastsol Posted February 23, 2016 Solution Share Posted February 23, 2016 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. Quote Link to comment https://forums.phpfreaks.com/topic/300864-emailing-uploaded-files-links/#findComment-1531370 Share on other sites More sharing options...
MsKazza Posted February 23, 2016 Author Share Posted February 23, 2016 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 Quote Link to comment https://forums.phpfreaks.com/topic/300864-emailing-uploaded-files-links/#findComment-1531372 Share on other sites More sharing options...
ginerjm Posted February 23, 2016 Share Posted February 23, 2016 Many people (me as one) do not like to click on links that go to unknown places. The site also allows for the posting of code which makes it much safer for all to see your concerns. Quote Link to comment https://forums.phpfreaks.com/topic/300864-emailing-uploaded-files-links/#findComment-1531377 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.