<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: WordPress: adding a custom option box and developing file upload plugin</title>
	<atom:link href="http://www.tanzilo.com/2009/01/15/wordpress-adding-a-custom-option-box-and-developing-file-upload-plugin/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.tanzilo.com/2009/01/15/wordpress-adding-a-custom-option-box-and-developing-file-upload-plugin/</link>
	<description>Talks on Web Technology and Better Product Development</description>
	<lastBuildDate>Fri, 23 Jul 2010 21:02:58 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=abc</generator>
	<item>
		<title>By: Jeff Ballweg</title>
		<link>http://www.tanzilo.com/2009/01/15/wordpress-adding-a-custom-option-box-and-developing-file-upload-plugin/comment-page-1/#comment-723</link>
		<dc:creator>Jeff Ballweg</dc:creator>
		<pubDate>Thu, 17 Jun 2010 01:02:13 +0000</pubDate>
		<guid isPermaLink="false">http://www.tanzilo.com/?p=70#comment-723</guid>
		<description>1. Definitely the best way to add enctype=”multipart/form-data” is to add it with jQuery. In my case, I made an upload control, that is added to the Post page, and the jQuery is executed there.

2. You don&#039;t need to do all that stuff directly on the database, unless you have a massive need to. Try:
   add_post_meta($post_id, &#039;_your_option_name&#039;, &#039;your option value&#039;)
This will save it as a custom field attached to the post. Retrieve the value with
   get_post_meta($post_id, &#039;_your_option_name&#039;)

3. You might find that hooking &#039;save_post&#039; is going to fire your event twice, which might have an upload error on the second attempt (and, in your method, definitely go through a second series of database transactions) set a global flag and check for it.. eg,
     global $flag =0;
     if($flag == 0) {
        // do you code
        $flag = 1;
     }

Cheers from New Zealand.</description>
		<content:encoded><![CDATA[<p>1. Definitely the best way to add enctype=”multipart/form-data” is to add it with jQuery. In my case, I made an upload control, that is added to the Post page, and the jQuery is executed there.</p>
<p>2. You don&#8217;t need to do all that stuff directly on the database, unless you have a massive need to. Try:<br />
   add_post_meta($post_id, &#8216;_your_option_name&#8217;, &#8216;your option value&#8217;)<br />
This will save it as a custom field attached to the post. Retrieve the value with<br />
   get_post_meta($post_id, &#8216;_your_option_name&#8217;)</p>
<p>3. You might find that hooking &#8216;save_post&#8217; is going to fire your event twice, which might have an upload error on the second attempt (and, in your method, definitely go through a second series of database transactions) set a global flag and check for it.. eg,<br />
     global $flag =0;<br />
     if($flag == 0) {<br />
        // do you code<br />
        $flag = 1;<br />
     }</p>
<p>Cheers from New Zealand.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Adam Jowell</title>
		<link>http://www.tanzilo.com/2009/01/15/wordpress-adding-a-custom-option-box-and-developing-file-upload-plugin/comment-page-1/#comment-717</link>
		<dc:creator>Adam Jowell</dc:creator>
		<pubDate>Wed, 12 May 2010 08:49:34 +0000</pubDate>
		<guid isPermaLink="false">http://www.tanzilo.com/?p=70#comment-717</guid>
		<description>Sorry, did not mean for you to do it. Was wondering if it were possible with the existing script.</description>
		<content:encoded><![CDATA[<p>Sorry, did not mean for you to do it. Was wondering if it were possible with the existing script.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: admin</title>
		<link>http://www.tanzilo.com/2009/01/15/wordpress-adding-a-custom-option-box-and-developing-file-upload-plugin/comment-page-1/#comment-716</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Wed, 12 May 2010 08:47:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.tanzilo.com/?p=70#comment-716</guid>
		<description>@ Adam

May be.
But I am too busy to do that.
Sorry.</description>
		<content:encoded><![CDATA[<p>@ Adam</p>
<p>May be.<br />
But I am too busy to do that.<br />
Sorry.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Adam Jowell</title>
		<link>http://www.tanzilo.com/2009/01/15/wordpress-adding-a-custom-option-box-and-developing-file-upload-plugin/comment-page-1/#comment-715</link>
		<dc:creator>Adam Jowell</dc:creator>
		<pubDate>Wed, 12 May 2010 07:53:55 +0000</pubDate>
		<guid isPermaLink="false">http://www.tanzilo.com/?p=70#comment-715</guid>
		<description>Can you make that into a front-end public form??</description>
		<content:encoded><![CDATA[<p>Can you make that into a front-end public form??</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andy</title>
		<link>http://www.tanzilo.com/2009/01/15/wordpress-adding-a-custom-option-box-and-developing-file-upload-plugin/comment-page-1/#comment-707</link>
		<dc:creator>Andy</dc:creator>
		<pubDate>Mon, 22 Mar 2010 10:29:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.tanzilo.com/?p=70#comment-707</guid>
		<description>hey guys

love the idea of this plugin but as mentioned above I get this error and don&#039;t know how to fix it:

Warning: opendir(../bag_thumb/) [function.opendir]: failed to open dir: No such file or directory in /home/websitename/public_html/wp-content/plugins/bag-thumb/bag-thumb.php on line 47

Any idea?

Thanks

Andy</description>
		<content:encoded><![CDATA[<p>hey guys</p>
<p>love the idea of this plugin but as mentioned above I get this error and don&#8217;t know how to fix it:</p>
<p>Warning: opendir(../bag_thumb/) [function.opendir]: failed to open dir: No such file or directory in /home/websitename/public_html/wp-content/plugins/bag-thumb/bag-thumb.php on line 47</p>
<p>Any idea?</p>
<p>Thanks</p>
<p>Andy</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lee</title>
		<link>http://www.tanzilo.com/2009/01/15/wordpress-adding-a-custom-option-box-and-developing-file-upload-plugin/comment-page-1/#comment-686</link>
		<dc:creator>Lee</dc:creator>
		<pubDate>Mon, 15 Feb 2010 18:10:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.tanzilo.com/?p=70#comment-686</guid>
		<description>Hi

IS there a way to add a wordpress standard file upload to a field on the new post page? ie one which will upload the file and create the thumbnails etc?

I have a site where the client has to upload the media, then cancel and manually add the URLs to custom fields in the post.

Thanks


Lee</description>
		<content:encoded><![CDATA[<p>Hi</p>
<p>IS there a way to add a wordpress standard file upload to a field on the new post page? ie one which will upload the file and create the thumbnails etc?</p>
<p>I have a site where the client has to upload the media, then cancel and manually add the URLs to custom fields in the post.</p>
<p>Thanks</p>
<p>Lee</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mariano</title>
		<link>http://www.tanzilo.com/2009/01/15/wordpress-adding-a-custom-option-box-and-developing-file-upload-plugin/comment-page-1/#comment-683</link>
		<dc:creator>Mariano</dc:creator>
		<pubDate>Fri, 05 Feb 2010 05:40:48 +0000</pubDate>
		<guid isPermaLink="false">http://www.tanzilo.com/?p=70#comment-683</guid>
		<description>Dont forget to wrap the jQuery code into script tags (Can&#039;t post script tags)</description>
		<content:encoded><![CDATA[<p>Dont forget to wrap the jQuery code into script tags (Can&#8217;t post script tags)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mariano</title>
		<link>http://www.tanzilo.com/2009/01/15/wordpress-adding-a-custom-option-box-and-developing-file-upload-plugin/comment-page-1/#comment-682</link>
		<dc:creator>Mariano</dc:creator>
		<pubDate>Fri, 05 Feb 2010 04:07:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.tanzilo.com/?p=70#comment-682</guid>
		<description>Don&#039;t know how to hook with the post/page form head so i used the admin_head instead... I know it sucks, but it still works :)
jQuery way to add the form enctype:

function form_fix_js()
{
	?&gt;
	
	jQuery(document).ready(function($){
		$(&#039;form#post&#039;).attr({ encoding: &#039;multipart/form-data&#039;, enctype: &#039;multipart/form-data&#039; });
	});
	
	&lt;?
}

add_action(&#039;admin_head&#039;, &#039;form_fix_js&#039;);</description>
		<content:encoded><![CDATA[<p>Don&#8217;t know how to hook with the post/page form head so i used the admin_head instead&#8230; I know it sucks, but it still works <img src='http://www.tanzilo.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
jQuery way to add the form enctype:</p>
<p>function form_fix_js()<br />
{<br />
	?&gt;</p>
<p>	jQuery(document).ready(function($){<br />
		$(&#8216;form#post&#8217;).attr({ encoding: &#8216;multipart/form-data&#8217;, enctype: &#8216;multipart/form-data&#8217; });<br />
	});</p>
<p>	&lt;?<br />
}</p>
<p>add_action(&#039;admin_head&#039;, &#039;form_fix_js&#039;);</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jayson</title>
		<link>http://www.tanzilo.com/2009/01/15/wordpress-adding-a-custom-option-box-and-developing-file-upload-plugin/comment-page-1/#comment-661</link>
		<dc:creator>Jayson</dc:creator>
		<pubDate>Sat, 09 Jan 2010 02:53:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.tanzilo.com/?p=70#comment-661</guid>
		<description>Thanks so much, let me play a bit more in the code, you have excellent structure, its just a matter of a few aspects.  I will let you know what I end up with.  Thanks again for your generosity.</description>
		<content:encoded><![CDATA[<p>Thanks so much, let me play a bit more in the code, you have excellent structure, its just a matter of a few aspects.  I will let you know what I end up with.  Thanks again for your generosity.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: jeff</title>
		<link>http://www.tanzilo.com/2009/01/15/wordpress-adding-a-custom-option-box-and-developing-file-upload-plugin/comment-page-1/#comment-660</link>
		<dc:creator>jeff</dc:creator>
		<pubDate>Fri, 08 Jan 2010 22:08:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.tanzilo.com/?p=70#comment-660</guid>
		<description>That is amazing and simple to understand! Thank you for sharing. :)</description>
		<content:encoded><![CDATA[<p>That is amazing and simple to understand! Thank you for sharing. <img src='http://www.tanzilo.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
</channel>
</rss>
