UbH Posted January 10, 2008 Share Posted January 10, 2008 I have a upload form that allows a user to upload 5 files. After a user hits the forms submit button, my PHP uploading script runs. This PHP uploading script uploads the files to its proper location and then begins to write up and send out an email. In this email that gets sent out I have a URL path to each file so the person can download the files straight from their email. However if the person who is uploading files only uploads say 4 out of the 5 that is allowed, this email still shows 5 URLs. The 5th URL only points up to the folder where a 5th file would be if one had been uploaded. <Problem Begins So I am trying to write a condition that wont display a url of a non uploaded file but rather a message saying something like "Sorry No Fifth file was uploaded". Like So: //Local Location of files 1-5 $path1= "a_subfolder/another_subfolder/".$HTTP_POST_FILES['ufile']['name'][0]; $path2= "a_subfolder/another_subfolder/".$HTTP_POST_FILES['ufile']['name'][1]; $path3= "a_subfolder/another_subfolder/".$HTTP_POST_FILES['ufile']['name'][2]; $path4= "a_subfolder/another_subfolder/".$HTTP_POST_FILES['ufile']['name'][3]; $path5= "a_subfolder/another_subfolder/".$HTTP_POST_FILES['ufile']['name'][4]; //Global Site Path $GlobalPath = "http://www.mywebsite.com/"; //Nothing Uploaded Message $noUpload = "Sorry No Fifth File Was Uploaded"; if ($path5 == false) { $path5 = $noUload; } else { $path5=$GlobalPath.$path5; } //Now I can use $path1-5 in my email message and this condition will decide how it will come out when the user receives the email Can someone tell me what am I doing wrong here?? Quote Link to comment https://forums.phpfreaks.com/topic/85449-solved-email-with-paths-to-uploaded-files-hmm/ Share on other sites More sharing options...
drummer101 Posted January 11, 2008 Share Posted January 11, 2008 <?php if(empty($HTTP_POST_FILES['ufile']['name'][0])){ } else { $path1= "a_subfolder/another_subfolder/".$HTTP_POST_FILES['ufile']['name'][0]; } ?> etc Quote Link to comment https://forums.phpfreaks.com/topic/85449-solved-email-with-paths-to-uploaded-files-hmm/#findComment-436306 Share on other sites More sharing options...
UbH Posted January 16, 2008 Author Share Posted January 16, 2008 Worked like a charm!! Thanks for all your help m8!! Quote Link to comment https://forums.phpfreaks.com/topic/85449-solved-email-with-paths-to-uploaded-files-hmm/#findComment-441405 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.