if $file was uploaded.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
ol4pr0
Forum Regular
Posts: 926
Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador

if $file was uploaded.

Post by ol4pr0 »

Oke right to the point.

upload works nice and all that, however i want to add a mime mail after the file has been uploaded.

Code: Select all

// this is basicly how the uplaod ends as you can see.
// now how do i go about on turning this end into a automatic mime mail.

// the mime mail itself is not the problem since i already am able to do 
// that.
// exept for getting the right filename that was uploaded ;-(

$endresult = "File Was Uploaded";
User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Post by m3mn0n »

An if() statment maybe?

Code: Select all

<?php

if ( $endresult == "File Was Uploaded" )
{

    // mime mail

}
?>
User avatar
ol4pr0
Forum Regular
Posts: 926
Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador

Post by ol4pr0 »

Did thought of that.. however i do not understand why this error occurs

Code: Select all

break;
case "doupload":
include "config.php";
if ( $endresult == " File Was Uploaded ") 

// whole bunch of the mime...


$mime->addAttachment($file, 'text/plain');
$body = $mime->get();
$hdrs = $mime->headers($hdrs);
$mail =& Mail::factory('mail');
$mail->send('root@tms.com', $hdrs, $body);

header("location: http://10.10.10.10");
}
else {
if ($file_name == "") {
$endresult = "<font size="2">No file selected</font>";
}

Parse error upload.php on line 164

which is basicly outside the script

Code: Select all

</html>";
break;
}

?> line 163
User avatar
ol4pr0
Forum Regular
Posts: 926
Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador

Post by ol4pr0 »

Code: Select all

//fixedbreak 
}
}
new errors


Notice: Undefined variable: endresult in /usr/local/apache2/htdocs/system/upload.php on line 79

Notice: Undefined variable: endresult in /usr/local/apache2/htdocs/system/upload.php on line 140

Code: Select all

//line 79
if ( $endresult == "<font size="2" color="red">File Was Uploaded</font>") {

// line 140

<td bgcolor="#FFFFFF">
	<center><font color="000000"> $file_name</font> $endresult</center> //140
	</td>
User avatar
ol4pr0
Forum Regular
Posts: 926
Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador

Post by ol4pr0 »

Code: Select all

// never mind.. 

$endresult = "";
if ($............
}else{
// and all the other .
User avatar
ol4pr0
Forum Regular
Posts: 926
Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador

Post by ol4pr0 »

now the sending part lol needs some fixing guess that for tomorrow
Post Reply