<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>piouPiouM&#039;s dev&#187; Archives pour le tag upload – piouPiouM&#039;s dev</title>
	<atom:link href="http://pioupioum.fr/tag/upload/feed/" rel="self" type="application/rss+xml" />
	<link>http://pioupioum.fr</link>
	<description>Bloc-note d&#039;un développeur web</description>
	<lastBuildDate>Thu, 05 Aug 2010 13:48:33 +0000</lastBuildDate>
	
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>WordPress&#160;: autoriser l&#8217;upload de fichiers au format non-supporté</title>
		<link>http://pioupioum.fr/snippets/wordpress-autoriser-upload-media-format-inconnu.html</link>
		<comments>http://pioupioum.fr/snippets/wordpress-autoriser-upload-media-format-inconnu.html#comments</comments>
		<pubDate>Tue, 09 Feb 2010 14:50:30 +0000</pubDate>
		<dc:creator>piouPiouM</dc:creator>
				<category><![CDATA[Snippets]]></category>
		<category><![CDATA[astuces]]></category>
		<category><![CDATA[media]]></category>
		<category><![CDATA[upload]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://pioupioum.fr/?p=316</guid>
		<description><![CDATA[WordPress ne supporte en upload qu&#8217;une liste exhaustive de formats de fichiers. Si comme moi vous souhaitez uploader1 des fichiers issus de TextMate, comme les .tmCommand et autres .tmSnippet, ajoutez le code qui suit dans le fichier functions.php de votre thème2.


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
&#60;?php
// Add the new filter
add_filter&#40;'upload_mimes', 'addUploadMimes'&#41;;
&#160;
/**
 * Adds new supported media types for upload.
 *
 [...]]]></description>
			<content:encoded><![CDATA[<!-- google_ad_section_start --><p>WordPress ne supporte en upload qu&#8217;une liste exhaustive de formats de fichiers. Si comme moi vous souhaitez uploader<sup id="fnref:1"><a href="#fn:1" rel="footnote">1</a></sup> des fichiers issus de <a href="http://macromates.com/" title="TextMate — The Missing Editor for Mac OS X">TextMate</a>, comme les <code>.tmCommand</code> et autres <code>.tmSnippet</code>, ajoutez le code qui suit dans le fichier <code>functions.php</code> de votre thème<sup id="fnref:2"><a href="#fn:2" rel="footnote">2</a></sup>.</p>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #666666; font-style: italic;">// Add the new filter</span>
add_filter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'upload_mimes'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'addUploadMimes'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009933; font-style: italic;">/**
 * Adds new supported media types for upload.
 *
 * @see wp_check_filetype() or get_allowed_mime_types()
 * @param array $mimes Array of mime types keyed by the file extension regex corresponding to those types.
 * @return array
 */</span>
<span style="color: #000000; font-weight: bold;">function</span> addUploadMimes<span style="color: #009900;">&#40;</span><span style="color: #000088;">$mimes</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$mimes</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array_merge</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$mimes</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
		<span style="color: #0000ff;">'tmbundle|tmCommand|tmDragCommand|tmSnippet|tmLanguage|tmPreferences'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/octet-stream'</span>
	<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #b1b100;">return</span> <span style="color: #000088;">$mimes</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>


<p>Indiquez en clé les nouvelles extensions de fichier (séparées par des <em>pipes</em>) et en valeur le type mime associé.</p>

<h3 class='related_post_title'>Continuez votre lecture sur des sujets similaires</h3>

<ul class='related_post'><li><a href='http://pioupioum.fr/outils-astuces/wordpress-recuperation-avancee-images-article.html' title='WordPress : récupération avancée des images d&#8217;un article'>WordPress&#160;: récupération avancée des images d&#8217;un article</a></li><li><a href='http://pioupioum.fr/outils-astuces/afficher-images-article-page-media.html' title='WordPress : lister les images d&#8217;un article sur une page media'>WordPress&#160;: lister les images d&#8217;un article sur une page media</a></li><li><a href='http://pioupioum.fr/developpement/optimiser-rapidite-chargement-adsense-jquery.html' title='Optimiser le chargement des AdSense'>Optimiser le chargement des AdSense</a></li><li><a href='http://pioupioum.fr/snippets/apache-rotation-logs.html' title='Rotation des logs Apache'>Rotation des logs Apache</a></li><li><a href='http://pioupioum.fr/plugins-wordpress/wordpress-jquery-ui-effects.html' title='WordPress jQuery UI Effects'>WordPress jQuery UI Effects</a></li></ul>

<div class="footnotes">
<hr />
<ol>

<li id="fn:1">
<p>sous Mac OS X tout du moins, <a href="http://swfupload.org/" title="SWFUpload News | SWFUpload">SWFUpload</a> me désactive la sélection des fichiers de TextMate m&#8217;obligeant à passer par l&#8217;interface d&#8217;upload native du navigateur. Je suis preneur de toute solution.&#160;<a href="#fnref:1" rev="footnote">&#8617;</a></p>
</li>

<li id="fn:2">
<p>à choisir, l&#8217;ajouter dans un plugin serait plus judicieux puisque cette fonctionnalité ne dépend pas du thème.&#160;<a href="#fnref:2" rev="footnote">&#8617;</a></p>
</li>

</ol>
</div>
<!-- google_ad_section_end -->]]></content:encoded>
			<wfw:commentRss>http://pioupioum.fr/snippets/wordpress-autoriser-upload-media-format-inconnu.html/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
