unable to finish tutorial

Ask about a PHP problem here.
Post Reply
ud3webdev
Posts: 4
Joined: Thu Jun 28, 2012 1:39 pm

unable to finish tutorial

Post by ud3webdev »

Hey, the first 2 parts were okay, and then after about 1:40 min in to the 3rd video the video quality just went to crap for some reason, it was on 720p, then i tested all quality levels and its just a mess.http://www.youtube.com/watch?v=3tnFPs_M ... B56BE54CEB

not sure if some one has the source code for this mail attachment video but this is how far im able to get and im sure even this is wrong because i cant make it out.
function mail_file($to, $from, $subject, $body, $file) {
	$boundary = md5(rand());
	
	$headers = array(
		'MIME-Version: 1.0',
		"from: ($from)",
		"Content=Type: multipart/mixed; boundry= ($boundry)"
	};
	
	$message = array(
		
	);
}
thanks.
Last edited by jacek on Fri Jul 20, 2012 1:53 am, edited 1 time in total.
Reason: code tags...
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: unable to finish tutorial

Post by jacek »

Hmm, not sure what happened there. I guess I have a video to re-make :P

Here is the code anyway
<?php

// sends the given meesage to the given email address attaching the given file.
function mail_file($to, $from, $subject, $body, $file){
	$boundary = md5(rand());
	
	$headers = array(
		'MIME-Version: 1.0',
		"From: {$from}",
		"Content-Type: multipart/mixed; boundary=\"{$boundary}\""
	);
	
	$message = array(
		"--{$boundary}",
		"Content-Type: text/plain; charset=\"utf-8\"",
		"Content-Transfer-Encoding: 7bit",
		"",
		chunk_split($body),
		"--{$boundary}",
		"Content-Type: {$file['type']}; name=\"{$file['name']}\"",
		"Content-Disposition: attachment; filename=\"{$file['name']}\"",
		"Content-Transfer-Encoding: base64",
		"",
		chunk_split(base64_encode(file_get_contents($file['path']))),
		"--{$boundary}--",
	);
	
	return mail($to, $subject, implode("\r\n", $message), implode("\r\n", $headers));
}

?>
Image
Post Reply