<?xml version='1.0' encoding="utf-8"?>
      <rss version='2.0'>
      <channel>
      <title>Форум на Исходниках.RU</title>
      <link>https://forum.sources.ru</link>
      <description>Форум на Исходниках.RU</description>
      <generator>Форум на Исходниках.RU</generator>
  	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=64069&amp;view=findpost&amp;p=441931</guid>
        <pubDate>Thu, 26 Aug 2004 10:07:55 +0000</pubDate>
        <title>Работа с файлами в PHP</title>
        <link>https://forum.sources.ru/index.php?showtopic=64069&amp;view=findpost&amp;p=441931</link>
        <description><![CDATA[Shaden: Всем большое спасибо&#33; :)]]></description>
        <author>Shaden</author>
        <category>PHP</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=64069&amp;view=findpost&amp;p=441817</guid>
        <pubDate>Thu, 26 Aug 2004 08:50:04 +0000</pubDate>
        <title>Работа с файлами в PHP</title>
        <link>https://forum.sources.ru/index.php?showtopic=64069&amp;view=findpost&amp;p=441817</link>
        <description><![CDATA[Trustmaster: Тип загружаемого файла следует брать из переменной &#036;_FILES[&#39;userfile&#39;][&#39;type&#39;], она для этой цели и задается.<br>
<br>
А вообще, в PHP есть функция filetype(), которая работает с любыми файлами, а не только с картинками.<br>
<br>
Вот некоторые MIME-типы, которые тебя интересуют:<br>
<div class='tag-quote'><span class='tag-quote-prefix'>Цитата</span> <div class='quote '>image/gif<br>
image/jpeg<br>
image/png</div></div><br>
С этими значениями тебе и надо сравнивать &#036;_FILES[&#39;userfile&#39;][&#39;type&#39;].]]></description>
        <author>Trustmaster</author>
        <category>PHP</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=64069&amp;view=findpost&amp;p=441796</guid>
        <pubDate>Thu, 26 Aug 2004 08:32:06 +0000</pubDate>
        <title>Работа с файлами в PHP</title>
        <link>https://forum.sources.ru/index.php?showtopic=64069&amp;view=findpost&amp;p=441796</link>
        <description><![CDATA[bizar: <a class='tag-url' href='http://detail.phpclub.net/article/upload' target='_blank'>http://detail.phpclub.net/article/upload</a><br>
<br>
<br>
Manual - Image Functions<br>
<br>
array getimagesize ( string filename [, array imageinfo])]]></description>
        <author>bizar</author>
        <category>PHP</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=64069&amp;view=findpost&amp;p=441785</guid>
        <pubDate>Thu, 26 Aug 2004 08:25:06 +0000</pubDate>
        <title>Работа с файлами в PHP</title>
        <link>https://forum.sources.ru/index.php?showtopic=64069&amp;view=findpost&amp;p=441785</link>
        <description><![CDATA[Rom@nych: <strong class='tag-b'>Argentum</strong>, ИМХО ты не прав. Ибо человек не спрашивал, как закачать файл, а спрашивал как определить его тип.  Ничто не мешает человеку exe переименовать gif и будет послан MIME-тип файла: image/gif &#33;&#33;&#33; Приведённая мною ф-ция смотрит не на расширение файла, а на его заголовок.]]></description>
        <author>Rom@nych</author>
        <category>PHP</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=64069&amp;view=findpost&amp;p=441766</guid>
        <pubDate>Thu, 26 Aug 2004 08:15:46 +0000</pubDate>
        <title>Работа с файлами в PHP</title>
        <link>https://forum.sources.ru/index.php?showtopic=64069&amp;view=findpost&amp;p=441766</link>
        <description><![CDATA[Argentum: Это можно осуществить при помощи <a class='tag-url' href='http://optimal.odessa.ua/Docs/RFC/rfc1867.html' target='_blank'>Form based file upload</a><br>
А вообще посмотри здесь:<br>
<a class='tag-url' href='http://forum.sources.ru/index.php?showtopic=58660#' target='_blank'>PHP: Загрузка файла на сервер</a>]]></description>
        <author>Argentum</author>
        <category>PHP</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=64069&amp;view=findpost&amp;p=441759</guid>
        <pubDate>Thu, 26 Aug 2004 08:11:29 +0000</pubDate>
        <title>Работа с файлами в PHP</title>
        <link>https://forum.sources.ru/index.php?showtopic=64069&amp;view=findpost&amp;p=441759</link>
        <description><![CDATA[Rom@nych: Если тебе надо проверить, на то, является-ли файл картинкой, то можно ипсользовать такой код:<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">&nbsp;</div><div class="code_line">&#60;?php</div><div class="code_line">&nbsp;</div><div class="code_line">if (exif_imagetype(&quot;image.gif&quot;) != IMAGETYPE_GIF) {</div><div class="code_line">&nbsp;&nbsp; &nbsp;echo &quot;The picture is not a gif&quot;;</div><div class="code_line">}</div><div class="code_line">&nbsp;</div><div class="code_line">?&#62; </div></ol></div></div></div></div><script>preloadCodeButtons('1');</script><br>
<br>
Цитата из мана<br>
<div class='tag-quote'><span class='tag-quote-prefix'>Цитата</span> <div class='quote '><br>
exif_imagetype<br>
(PHP 4 &gt;= 4.3.0, PHP 5)<br>
<br>
exif_imagetype -- Determine the type of an image<br>
Description<br>
int exif_imagetype ( string filename)<br>
<br>
<br>
exif_imagetype() reads the first bytes of an image and checks its signature. When a correct signature is found a constant will be returned otherwise the return value is FALSE. The return value is the same value that getimagesize() returns in index 2 but this function is much faster. <br>
</div></div><br>
<br>
Узнать разширения файла можно просто:<br>
<div class='tag-code'><span class='pre_code'></span><div class='code  code_collapsed ' title='Подсветка синтаксиса доступна зарегистрированным участникам Форума.' style=''><div><div><ol type="1"><div class="code_line">&nbsp;</div><div class="code_line">$file = &#39;/mnt/win_c/autoexec.bat&#39;;</div><div class="code_line">$parts = explode(&#39;.&#39;, $file);</div><div class="code_line">$ext = $parts[count($parts) - 1];</div></ol></div></div></div></div>]]></description>
        <author>Rom@nych</author>
        <category>PHP</category>
      </item>
	
      <item>
        <guid isPermaLink='true'>https://forum.sources.ru/index.php?showtopic=64069&amp;view=findpost&amp;p=441622</guid>
        <pubDate>Thu, 26 Aug 2004 05:38:40 +0000</pubDate>
        <title>Работа с файлами в PHP</title>
        <link>https://forum.sources.ru/index.php?showtopic=64069&amp;view=findpost&amp;p=441622</link>
        <description><![CDATA[Shaden: Здравствуйте, уважаемые&#33;...<br>У меня такой вопрос: как программно узнать расширение файла- мне необходимо написать скрипт, который будет закачивать картинки на сервер. Есть ли в PHP такая функция?<br>А также интересно, есть ли альтернативные методы узнать тип файла, не только по его расширению, а каким-то другим способом?<br>Заранее огромное спасибо&#33;]]></description>
        <author>Shaden</author>
        <category>PHP</category>
      </item>
	
      </channel>
      </rss>
	