<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.infopathdev.com:443/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>General</title><link>https://www.infopathdev.com:443/forums/41.aspx</link><description>If you're not sure where to ask your question, ask it here. If necessary, our moderators will make sure it gets classified in the correct board.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: Trim Attachment Filename</title><link>https://www.infopathdev.com:443/forums/thread/99965.aspx</link><pubDate>Thu, 06 Nov 2014 18:56:50 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:99965</guid><dc:creator>Ravik</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/99965.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=99965</wfw:commentRss><description>Hi Dan,

Sorry for the late reply. I do have Decoding and Encoding for my file attachments. What i was trying to do was, when the user tries to upload a file with a file name more than 128 characters. I wanted to trim the file name before it gets pushed to the library. Please see my code below

  private string CleanFileName(string filename)
        {
            string invalidCharacters = &amp;quot;[\\~#%&amp;amp;*{}/:&amp;lt;&amp;gt;?|\&amp;quot;-]&amp;quot;;
            Regex invalidCharactersRegex = new Regex(invalidCharacters);

            filename = Regex.Replace(invalidCharactersRegex.Replace(filename, &amp;quot;&amp;quot;), @&amp;quot;\s+&amp;quot;, &amp;quot;&amp;quot;);

            if (filename.Length &amp;gt; 128)
            {
                filename = string.Format(&amp;quot;{0}.{1}&amp;quot;,Path.GetFileNameWithoutExtension(filename).Substring(0, 128), Path.GetExtension(filename));
            }

            return filename;
        }

Not sure what i am doing wrong here. 

Look forward to hear from you.

Regards,

Ravi</description></item><item><title>Re: Trim Attachment Filename</title><link>https://www.infopathdev.com:443/forums/thread/99891.aspx</link><pubDate>Mon, 03 Nov 2014 09:55:22 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:99891</guid><dc:creator>donstephen</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/99891.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=99891</wfw:commentRss><description>&lt;p&gt;Hi Ravik,&lt;br /&gt;&lt;br /&gt;Please refer to Hilary&amp;#39;s post from this &lt;a href="http://www.infopathdev.com/forums/t/23016.aspx"&gt;thread&lt;/a&gt;. Alternatively, you can also use qRules to validate or even overwrite the file name with a desired value (based from other fields, current user, etc.) without writing code. Hope this helps.&lt;/p&gt;</description></item><item><title>Trim Attachment Filename</title><link>https://www.infopathdev.com:443/forums/thread/99839.aspx</link><pubDate>Wed, 29 Oct 2014 16:30:09 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:99839</guid><dc:creator>Ravik</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/99839.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=41&amp;PostID=99839</wfw:commentRss><description>Hi All,

Is there a way to restrict or trim the attachment file if it exceeds more than 100 or 128 character? 

Regards,

Ravi</description></item></channel></rss>