Jump to content

[SOLVED] Email with Paths to uploaded files HMM


Recommended Posts

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??

 

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.