Jump to content
Sign in to follow this  
noppie

customor add sample. help with uploading

Recommended Posts

I need to have customer send me pictures of what they would like me to make for them.. now the problem I am having is this script below has two uploads but the first one does not work. only the second one.. and I for the life of me can not figure it out.. Can any of you

 

thank you in advance.

noppie

 

 

 

 

<?php
/*
 $Id: contact_us.php,v 1.42 2003/06/12 12:17:07 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License

 Upload sample Contribution from Edo Kantor edokantor@yahoo.com
*/
require('includes/application_top.php');
require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_SAMPLES);
$error = false;
      if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'send')) {
//edit the following fields
require_once('includes/classes/class.phpmailer-lite.php');
$to      = 'sss@email.com'; //change to your email address
$email   = tep_db_prepare_input($HTTP_POST_VARS['email']);
$name    = tep_db_prepare_input($HTTP_POST_VARS['name']);
$subject = 'Upload Samples'; //change to your subject
$comment = tep_db_prepare_input($HTTP_POST_VARS['enquiry']);
$filename1 = basename( $_FILES['upload1']['name']);


$mail  = new PHPMailerLite(); // defaults to using php "Sendmail" (or Qmail, depending on availability)

$mail->IsMail(); // telling the class to use native PHP mail()

$body = eregi_replace("[\]",'',$comment); //clean user input

$mail->SetFrom( $email, 'upload sample');

$address = $to;

$mail->AddAddress($address, "Webmaster");

$mail->Subject = $subject;

$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test

$mail->MsgHTML($body);

$mail->AddAttachment($_FILES['upload1']['tmp_name'], "$filename1"); 

if (is_uploaded_file($_FILES['upload2']['tmp_name'])) {
$filename2 = basename( $_FILES['upload2']['name']);
$mail->AddAttachment($_FILES['upload2']['tmp_name'], "$filename2");
	}

if(!$mail->Send()) {
 $error = true;
} else {
  tep_redirect(tep_href_link(FILENAME_UPLOAD_SAMPLE, 'action=success'));  
}

 $messageStack->add('contact', ENTRY_EMAIL_ADDRESS_CHECK_ERROR);

 		}

 $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_SAMPLES));
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>

<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="0" cellpadding="3">
 <tr>
 	 <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
 </table></td>
<!-- body_text //-->
    <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0"><tr>

       <form enctype="multipart/form-data" action="upload_sample.php?action=send" method="post">

   <!--set file size limit to 2mb-->


	<td><table border="0" width="100%" cellspacing="0" cellpadding="0">

	<tr><td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
           <td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_contact_us.gif', HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
          </tr>
       </table></td>
     </tr>
     <tr>
			<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
		  </tr>
	<?php
	  if ($messageStack->size('contact') > 0) {
	?>
		  <tr>
			<td><?php echo $messageStack->output('contact'); ?></td>
		  </tr>
		  <tr>
			<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
		  </tr>
	<?php
	  }

	  if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'success')) {
	?>
		  <tr>
			<td class="main" align="center"><?php echo  TEXT_SUCCESS; ?></td>
		  </tr>
		  <tr>
			<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
		  </tr>
		  <tr>
			<td>




                   <table border="0" width="100%" cellspacing="0" cellpadding="2">
				  <tr>
					<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
					<td align="right"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td>
					<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
				  </tr>
				</table>

               </td>
		  </tr>
		 </table>
	<?php
	  } else {
	?>
		<table cellpadding="0" cellspacing="0" border="0" width="100%"> 
		 <tr>
			<td>


                   <table border="0" width="100%" cellspacing="5" cellpadding="2">
				  <tr>
					<td class="main"><?php echo ENTRY_NAME; ?></td>
				  </tr>
				  <tr>
					<td class="main"><?php echo tep_draw_input_field('name'); ?></td>
				  </tr>
				  <tr>
					<td class="main"><?php echo ENTRY_EMAIL; ?></td>
				  </tr>
				  <tr>
					<td class="main"><?php echo tep_draw_input_field('email'); ?></td>
				  </tr>

                     <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '10'); ?></td>

				  <tr>
					<td class="main"><?php echo ENTRY_ENQUIRY; ?></td>
				  </tr>
				  <tr>
					<td><?php echo tep_draw_textarea_field('enquiry', 'soft', 5, 5); ?></td>
				  </tr>

                     <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

                      <tr>
					<td class="main"><?php echo ENTRY_UPLOAD; ?></td>
				  </tr>

				  <tr>
					<td class="main">
                       <!--limit file size upload to 2mb-->
					  <input type="hidden" name="MAX_FILE_SIZE" value="2000000" />
				<?php echo tep_draw_file_field('upload1' , 'file'); ?></td>
				  </tr>

                     <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
                      <tr>
					<td class="main"><?php echo ENTRY_UPLOAD; ?></td>
				  </tr>

                     <tr>
					<td class="main">
				<?php echo tep_draw_file_field('upload2' , 'file'); ?></td>
				  </tr>

				  <tr>
				</table>
				<table cellpadding="0" cellspacing="0" border="0" width="100%">
					<tr><td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td></tr>
				</table>
				<table border="0" width="100%" cellspacing="0" cellpadding="2">
					  <tr>
						<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
						<td align="right"><?php echo tep_image_submit('button_continue.gif', IMAGE_BUTTON_CONTINUE); ?></td>
						<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
					  </tr>
				</table>
				<table cellpadding="0" cellspacing="0" border="0" width="100%">
					<tr><td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td></tr>
				</table>


                </td>
		  </tr>
	</table>


<?php
 }
?>




		</td></tr>
	</table>
</form></td>

<!-- body_text_eof //-->
   <td class="col_right">
<!-- right_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>
<!-- right_navigation_eof //-->
   </td>
 </tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //--></body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>


Peace is possible.. Please don't give up.

 

"War is --the old betraying the young"

Share this post


Link to post
Share on other sites

I need to have customer send me pictures of what they would like me to make for them.. now the problem I am having is this script below has two uploads but the first one does not work. only the second one.. and I for the life of me can not figure it out.. Can any of you

 

thank you in advance.

noppie

 

 

any help please

noppie

 

<?php
/*
 $Id: contact_us.php,v 1.42 2003/06/12 12:17:07 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License

 Upload sample Contribution from Edo Kantor edokantor@yahoo.com
*/
require('includes/application_top.php');
require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_SAMPLES);
$error = false;
      if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'send')) {
//edit the following fields
require_once('includes/classes/class.phpmailer-lite.php');
$to      = 'sss@email.com'; //change to your email address
$email   = tep_db_prepare_input($HTTP_POST_VARS['email']);
$name    = tep_db_prepare_input($HTTP_POST_VARS['name']);
$subject = 'Upload Samples'; //change to your subject
$comment = tep_db_prepare_input($HTTP_POST_VARS['enquiry']);
$filename1 = basename( $_FILES['upload1']['name']);


$mail  = new PHPMailerLite(); // defaults to using php "Sendmail" (or Qmail, depending on availability)

$mail->IsMail(); // telling the class to use native PHP mail()

$body = eregi_replace("[\]",'',$comment); //clean user input

$mail->SetFrom( $email, 'upload sample');

$address = $to;

$mail->AddAddress($address, "Webmaster");

$mail->Subject = $subject;

$mail->AltBody = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test

$mail->MsgHTML($body);

$mail->AddAttachment($_FILES['upload1']['tmp_name'], "$filename1"); 

if (is_uploaded_file($_FILES['upload2']['tmp_name'])) {
$filename2 = basename( $_FILES['upload2']['name']);
$mail->AddAttachment($_FILES['upload2']['tmp_name'], "$filename2");
	}

if(!$mail->Send()) {
 $error = true;
} else {
  tep_redirect(tep_href_link(FILENAME_UPLOAD_SAMPLE, 'action=success'));  
}

 $messageStack->add('contact', ENTRY_EMAIL_ADDRESS_CHECK_ERROR);

 		}

 $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_SAMPLES));
?>
<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>

<!-- header_eof //-->

<!-- body //-->
<table border="0" width="100%" cellspacing="0" cellpadding="3">
 <tr>
 	 <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
 </table></td>
<!-- body_text //-->
    <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0"><tr>

       <form enctype="multipart/form-data" action="upload_sample.php?action=send" method="post">

   <!--set file size limit to 2mb-->


	<td><table border="0" width="100%" cellspacing="0" cellpadding="0">

	<tr><td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
           <td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . 'table_background_contact_us.gif', HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td>
          </tr>
       </table></td>
     </tr>
     <tr>
			<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
		  </tr>
	<?php
	  if ($messageStack->size('contact') > 0) {
	?>
		  <tr>
			<td><?php echo $messageStack->output('contact'); ?></td>
		  </tr>
		  <tr>
			<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
		  </tr>
	<?php
	  }

	  if (isset($HTTP_GET_VARS['action']) && ($HTTP_GET_VARS['action'] == 'success')) {
	?>
		  <tr>
			<td class="main" align="center"><?php echo  TEXT_SUCCESS; ?></td>
		  </tr>
		  <tr>
			<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
		  </tr>
		  <tr>
			<td>




                   <table border="0" width="100%" cellspacing="0" cellpadding="2">
				  <tr>
					<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
					<td align="right"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td>
					<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
				  </tr>
				</table>

               </td>
		  </tr>
		 </table>
	<?php
	  } else {
	?>
		<table cellpadding="0" cellspacing="0" border="0" width="100%"> 
		 <tr>
			<td>


                   <table border="0" width="100%" cellspacing="5" cellpadding="2">
				  <tr>
					<td class="main"><?php echo ENTRY_NAME; ?></td>
				  </tr>
				  <tr>
					<td class="main"><?php echo tep_draw_input_field('name'); ?></td>
				  </tr>
				  <tr>
					<td class="main"><?php echo ENTRY_EMAIL; ?></td>
				  </tr>
				  <tr>
					<td class="main"><?php echo tep_draw_input_field('email'); ?></td>
				  </tr>

                     <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '10'); ?></td>

				  <tr>
					<td class="main"><?php echo ENTRY_ENQUIRY; ?></td>
				  </tr>
				  <tr>
					<td><?php echo tep_draw_textarea_field('enquiry', 'soft', 5, 5); ?></td>
				  </tr>

                     <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

                      <tr>
					<td class="main"><?php echo ENTRY_UPLOAD; ?></td>
				  </tr>

				  <tr>
					<td class="main">
                       <!--limit file size upload to 2mb-->
					  <input type="hidden" name="MAX_FILE_SIZE" value="2000000" />
				<?php echo tep_draw_file_field('upload1' , 'file'); ?></td>
				  </tr>

                     <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
                      <tr>
					<td class="main"><?php echo ENTRY_UPLOAD; ?></td>
				  </tr>

                     <tr>
					<td class="main">
				<?php echo tep_draw_file_field('upload2' , 'file'); ?></td>
				  </tr>

				  <tr>
				</table>
				<table cellpadding="0" cellspacing="0" border="0" width="100%">
					<tr><td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td></tr>
				</table>
				<table border="0" width="100%" cellspacing="0" cellpadding="2">
					  <tr>
						<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
						<td align="right"><?php echo tep_image_submit('button_continue.gif', IMAGE_BUTTON_CONTINUE); ?></td>
						<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
					  </tr>
				</table>
				<table cellpadding="0" cellspacing="0" border="0" width="100%">
					<tr><td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td></tr>
				</table>


                </td>
		  </tr>
	</table>


<?php
 }
?>




		</td></tr>
	</table>
</form></td>

<!-- body_text_eof //-->
   <td class="col_right">
<!-- right_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>
<!-- right_navigation_eof //-->
   </td>
 </tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //--></body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>


Peace is possible.. Please don't give up.

 

"War is --the old betraying the young"

Share this post


Link to post
Share on other sites

can anyone help__- thank you


Peace is possible.. Please don't give up.

 

"War is --the old betraying the young"

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×