This post might be useful for sharepoint designers who are using SharePoint Designer 2007.
Have you ever faced this alert in your custom pages :)
If you would like to add 'attach files' functionality to your custom SharePoint 2007 form you may want to visit the links below:
http://support.microsoft.com/default.aspx?scid=kb;en-us;953271&sd=rss&spid=12200
http://www.sharepoint911.com/blogs/laura/Lists/Posts/Post.aspx?List=676af157-7d96-4e15-a987-54b8a3e4d948&ID=10
Both articles are useful, however only one solution from the first link worked for my case so I will try to describe it below:
I had to create custom new form and custom edit forum for a sharePoint List and the 'attach file' functionality had to be implemented as well:
1.1 The following default code in a custom form:
<xsl:template name="dvt_1">
<xsl:variable name="dvt_StyleName">ListForm</xsl:variable>
<xsl:variable name="Rows" select="/dsQueryResponse/Rows/Row"/>
<table border="0" width="100%">
<xsl:call-template name="dvt_1.body">
<xsl:with-param name="Rows" select="$Rows"/>
</xsl:call-template>
</table>
</xsl:template>
is replaced by this code for a custom NewForm.aspx or EditForm.aspx page:
<xsl:variable name="dvt_StyleName">ListForm</xsl:variable>
<xsl:variable name="Rows" select="/dsQueryResponse/Rows/Row"/>
<div>
<span id="part1">
<table border="0" width="100%">
<xsl:call-template name="dvt_1.body">
<xsl:with-param name="Rows" select="$Rows"/>
</xsl:call-template>
</table>
<SharePoint:AttachmentUpload runat="server" ControlMode="New"/>
<SharePoint:ItemHiddenVersion runat="server" ControlMode="New"/>
</div>
</xsl:template>
1.2 For custom 'Edit' pages only. The following piece of code has been changed from....
<SharePoint:FormToolBar runat="server" ControlMode="Edit"/>
to...
<SharePoint:FormToolBar runat="server" ControlMode="New"/>
1.3 Add additional piece of code above the following line of code: <xsl:if test="$dvt_1_automode = '1'" ddwrt:cf_ignore="1">:
<tr id="idAttachmentsRow">
<td nowrap="true" valign="top" class="ms-formlabel" width="20%">
<SharePoint:FieldLabel ControlMode="New" FieldName="Attachments" runat="server"/>
</td>
<td valign="top" class="ms-formbody" width="80%">
<SharePoint:FormField runat="server" id="AttachmentsField{$Pos}" ControlMode="New" FieldName="Attachments" __designer:bind="{ddwrt:DataBind('i', concat('AttachmentsField',$Pos), 'Value', 'ValueChanged', 'ID', ddwrt:EscapeDelims(string(@ID)),' @Attachments')}"/>
</td>
</tr>
<script>
var elm = document.getElementById("idAttachmentsRow");
if (elm == null || elm.rows.length == 0)
elm.style.display='none';
</script>
This changes should bring back the 'attach file' functionality to your custom new or edit page. At least worked for me :) Please note if you get an JavaScript error this maybe caused of the fact that the SharePoint Designer 2007 may change the id of this element in the code
<tr id="idAttachmentsRow">
to
<tr id="idAttachmentsRow{generate-id()}">
Rename the Id back to id="idAttachmentsRow".
Thanks for your time!