Jump to content
  • Checkout
  • Login
  • Get in touch


The e-commerce.

Forms with attachment


Recommended Posts

Hey, so I am trying to modify the contact_us.php page to support the upload of a file as an attachment.


Here is the code I added in contact_us.php below the other input fields to allow for a file upload:


<tr><td class="main">Picture(s)</td></tr>

<tr><td class="main"><input type="file" name="attachment"></td></tr>


So I can see the upload form fine, and it looks like it works. The e-mail also sends fine, but it doesn't include the attachment if one is give.


I was looking around for a solution, and found that the enctype for the form must be: multipart/form-data


So, I went into includes/html_output.php and found the tep_draw_form function (which contact_us uses), and changed it to read



// Output a form

function tep_draw_form($name, $action, $method = 'post', $parameters = '') {

$form = '<form enctype="multipart/form-data" name="' . tep_output_string($name) . '" action="' . tep_output_string($action) . '" method="' . tep_output_string($method) . '"';


if (tep_not_null($parameters)) $form .= ' ' . $parameters;


$form .= '>';


return $form;




Again, the attachment still does not appear. I am unable to find a solution, can anyone help?



Link to comment
Share on other sites

does the upload itself work?


have you seen this contrib? http://www.oscommerce.com/community/contri...arch,attachment




addicted to writing code ... can't get enough of databases either, LOL!


my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum


Interactive Media Award July 2007 ~ category E-Commerce

my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...