<?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>Code</title><link>https://www.infopathdev.com:443/forums/45.aspx</link><description /><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: SOS: How to validate the attachment size of picture control</title><link>https://www.infopathdev.com:443/forums/thread/121254.aspx</link><pubDate>Fri, 12 Jul 2019 17:11:28 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:121254</guid><dc:creator>Ana313</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/121254.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=121254</wfw:commentRss><description>Hi..

i know this post is very old. but I want the similar requirement. How to add the validation when the file size attached is greater than 10kb in info-path form. I am using Infopath form 2013 and SharePoint 2016 on premise. I have tried the base 64 coding by using string length and the javascript on new item page. But both didnot worked. Your help would highly appreciate.</description></item><item><title>Re: SOS: How to validate the attachment size of picture control</title><link>https://www.infopathdev.com:443/forums/thread/104663.aspx</link><pubDate>Tue, 10 Nov 2015 17:32:48 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:104663</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/104663.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=104663</wfw:commentRss><description>Validation should happen as soon as the file is attached. Try making the number in your expression much smaller for the sake of experimentation, preview, and attach a large file and see if the control gets a red outline.</description></item><item><title>Re: SOS: How to validate the attachment size of picture control</title><link>https://www.infopathdev.com:443/forums/thread/104660.aspx</link><pubDate>Tue, 10 Nov 2015 05:22:52 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:104660</guid><dc:creator>hajjaj</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/104660.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=104660</wfw:commentRss><description>it is not validating , when I submit , its is not validating the size at all!</description></item><item><title>Re: SOS: How to validate the attachment size of picture control</title><link>https://www.infopathdev.com:443/forums/thread/104652.aspx</link><pubDate>Mon, 09 Nov 2015 23:00:39 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:104652</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/104652.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=104652</wfw:commentRss><description>This was for IP 2007, but I just successfully tested with 2013. Can you elaborate about what is not working?</description></item><item><title>Re: SOS: How to validate the attachment size of picture control</title><link>https://www.infopathdev.com:443/forums/thread/104625.aspx</link><pubDate>Sun, 08 Nov 2015 06:31:01 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:104625</guid><dc:creator>hajjaj</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/104625.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=104625</wfw:commentRss><description>it works with every except me :&amp;#39;(  , what is the issue with it ?</description></item><item><title>Re: SOS: How to validate the attachment size of picture control</title><link>https://www.infopathdev.com:443/forums/thread/23071.aspx</link><pubDate>Fri, 14 Sep 2007 10:41:13 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:23071</guid><dc:creator>realminds</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/23071.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=23071</wfw:commentRss><description>&lt;p&gt;I some how managed it by setting field value to 0 in actions and another action wit ha msgbox &amp;quot;Too big picture&amp;quot;&lt;/p&gt;</description></item><item><title>Re: SOS: How to validate the attachment size of picture control</title><link>https://www.infopathdev.com:443/forums/thread/23067.aspx</link><pubDate>Fri, 14 Sep 2007 06:32:44 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:23067</guid><dc:creator>realminds</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/23067.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=23067</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;I am somehow unable to restrict user to attach picture. Message is displayed &amp;quot;Picture is too big&amp;quot; but picture is attached.&lt;/p&gt;</description></item><item><title>Re: SOS: How to validate the attachment size of picture control</title><link>https://www.infopathdev.com:443/forums/thread/23066.aspx</link><pubDate>Fri, 14 Sep 2007 06:03:10 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:23066</guid><dc:creator>Patrick Halstead</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/23066.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=23066</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;&lt;/p&gt;I just learned something new. This is a sweet trick for limiting image size.</description></item><item><title>Re: SOS: How to validate the attachment size of picture control</title><link>https://www.infopathdev.com:443/forums/thread/23045.aspx</link><pubDate>Thu, 13 Sep 2007 19:47:43 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:23045</guid><dc:creator>realminds</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/23045.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=23045</wfw:commentRss><description>&lt;p&gt;Dear Davidair,&lt;/p&gt;
&lt;p&gt;You are the champion, you saved my life :). I went into picture control properties in IP 2007, then in rules, added required rule as an expression and it worked.&lt;/p&gt;
&lt;p&gt;Thank you very much as i was thinking of hell of Base64 encoding in VSTA.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: SOS: How to validate the attachment size of picture control</title><link>https://www.infopathdev.com:443/forums/thread/23043.aspx</link><pubDate>Thu, 13 Sep 2007 19:28:22 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:23043</guid><dc:creator>davidair</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/23043.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=23043</wfw:commentRss><description>&lt;p&gt;Use declarative validation...&lt;/p&gt;
&lt;p&gt;Suppose your attachment field is called field1 and you don&amp;#39;t want it to be bigger than 100k, that means that&amp;nbsp;length of the piture&amp;nbsp;field cannot be more than 136533 charaters (assuming UTF8).&lt;/p&gt;
&lt;p&gt;1. Open the Data Source pane&lt;br /&gt;2. Double-click on field1 to bring up its properties&lt;br /&gt;3. In Validation, add a new condition&lt;br /&gt;4. Select Expression, type this expression in: &lt;em&gt;&lt;strong&gt;string-length(.) &amp;gt; 136533&lt;/strong&gt;&lt;br /&gt;&lt;/em&gt;5. Enter the text to be displayed when the error condition occurs&lt;/p&gt;
&lt;p&gt;Now when you edit the form, if the image is too big, you will get an error validation and the user will be warned on save.&lt;/p&gt;</description></item><item><title>Re: SOS: How to validate the attachment size of picture control</title><link>https://www.infopathdev.com:443/forums/thread/23040.aspx</link><pubDate>Thu, 13 Sep 2007 18:45:27 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:23040</guid><dc:creator>realminds</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/23040.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=23040</wfw:commentRss><description>&lt;p&gt;Dear Davidair,&lt;/p&gt;
&lt;p&gt;Thanks for your reply, but i am not getting you point, should i use some rule, or use this validation in script? in rule i&amp;nbsp;can&amp;#39;t use integer value.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: SOS: How to validate the attachment size of picture control</title><link>https://www.infopathdev.com:443/forums/thread/23023.aspx</link><pubDate>Thu, 13 Sep 2007 05:47:33 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:23023</guid><dc:creator>davidair</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/23023.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=23023</wfw:commentRss><description>&lt;p&gt;You can either do it the hard way, as in decoding the header (see more here: &lt;a href="http://www.infopathdev.com/forums/p/1474/6839.aspx#6839"&gt;http://www.infopathdev.com/forums/p/1474/6839.aspx#6839&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;Or you can just make the following claim: binary files are encoded with BASE-64 encoding, so you only have 3 bytes get encoded with 4. That means that the original size of the file is the string length of the XML field * 0.75 (approximately because there is the header as well but it is negligeable).&lt;/p&gt;
&lt;p&gt;With this, you might simply use declarative validation instead of writing code, simply say &amp;quot;if string-length of this control is greater than this value, it&amp;#39;s an error&amp;quot;.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>SOS: How to validate the attachment size of picture control</title><link>https://www.infopathdev.com:443/forums/thread/23016.aspx</link><pubDate>Wed, 12 Sep 2007 17:47:45 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:23016</guid><dc:creator>realminds</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/23016.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=23016</wfw:commentRss><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Can anybody help&amp;nbsp;how to extract/find attached picture or file size of file or picture control&amp;nbsp;at design time or using&amp;nbsp;code behind (.Net or J/Vb script) at some event handler. Basically i have a form which is having many&amp;nbsp;file/picture attachment controls in different sections, But while submitting i want to make sure that attachment&amp;nbsp;size is limited to some KBs. Any help would be greatly appreciated.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item></channel></rss>