302 File Field Inputs

Form Index

File Inputs

File inputs require a bit more work than normal input fields.

The default enctype attribute in a form element is <form enctype="application/x-www-form-urlencoded">. When you include a file upload, this needs changed to <form enctype="multipart/form-data">.

This is done for you by the store if you have the default product page template. If you have modified product page template in any way the following line needs changed:

<form action="{STORESCRIPT}" onsubmit="return validateQty('{getLanguageString("ERR_INVALID_QUANTITY")}','{getLanguageString("PRODUCT_SORRY_OUT_OF_STOCK")}','{getLanguageString("PRODUCT_ENTER_LOWER_QTY")}');" method="post" name="frmMain" id="frmMain">

to

<form action="{STORESCRIPT}" onsubmit="return validateQty('{getLanguageString("ERR_INVALID_QUANTITY")}','{getLanguageString("PRODUCT_SORRY_OUT_OF_STOCK")}','{getLanguageString("PRODUCT_ENTER_LOWER_QTY")}');" method="post" name="frmMain" id="frmMain" enctype="{pageproperty['enctype']}">

In the edit templates interface in the WSM you search for the line that you need to replace, erase it and insert the new line. The eagle eyed will have noticed that the only difference is the last attribute enctype="{pageproperty['enctype']}". Adding this last attribute might be simpler!

Remember to save your template.