<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xml:base="https://www.webmaster-forums.net/crss/node/1022003" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title></title>
    <link>https://www.webmaster-forums.net/crss/node/1022003</link>
    <description></description>
    <language>en</language>
          <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/file-upload-issue#comment-1135758</link>
    <description> &lt;p&gt;&lt;a href=&quot;http://uk.php.net/manual/en/function.filetype.php&quot; class=&quot;bb-url&quot;&gt;http://uk.php.net/manual/en/function.filetype.php&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Hope this helps &lt;img src=&quot;https://www.webmaster-forums.net/misc/smileys/smile.png&quot; title=&quot;Smiling&quot; alt=&quot;Smiling&quot; class=&quot;smiley-content&quot; /&gt;&lt;/p&gt;
 </description>
     <pubDate>Wed, 06 Aug 2003 16:17:57 +0000</pubDate>
 <dc:creator>JeevesBond</dc:creator>
 <guid isPermaLink="false">comment 1135758 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/file-upload-issue#comment-1135757</link>
    <description> &lt;p&gt;ooooooohhh, I get it know. Interesting problem. Sorry I wasn&#039;t able to help. Glad PHP was, though. &lt;img src=&quot;https://www.webmaster-forums.net/misc/smileys/smile.png&quot; title=&quot;Smiling&quot; alt=&quot;Smiling&quot; class=&quot;smiley-content&quot; /&gt;&lt;/p&gt;
 </description>
     <pubDate>Wed, 06 Aug 2003 16:06:59 +0000</pubDate>
 <dc:creator>Suzanne</dc:creator>
 <guid isPermaLink="false">comment 1135757 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/file-upload-issue#comment-1135754</link>
    <description> &lt;p&gt;exactly. i want to know TYPE, not extension. the first fix given to me does extension, not type. and since php doesn&#039;t have gif in the gd it uses, if i accept anything other than jpegs, it&#039;ll be pngs. right now i just want jpgs. your fix works WHEN the browser gusses, but only in two of the three instances i know of. i&#039;m looking for one that will be universal, including the browser not guessing and leaving it blank (i know a few people that prevent their browsers from doing that)&lt;/p&gt;
&lt;p&gt;edit:&lt;br /&gt;
btw: i just found this on one of the other sites i&#039;m also part of:&lt;br /&gt;
there&#039;s something called iptcparse() which parses the iptc file header (what non windows systems use to tell things about images, since images use the iptc header). that function was too complex for my liking, but said to look at getimagesize.... turns out the 3rd of the 4 things it returns is actually the image TYPE (i think according to the  iptc header) which means the only people that will fool it have to be good enough with images that i&#039;d never be able to compete at my crrent level, so i&#039;m not going to bother trying. (unless someone that high decides to make an image-f*cking-with kit like that worm/trojan/virus kit that got into the news a few years back...but why someone would WANT to help script kiddies is beyond me)&lt;/p&gt;
 </description>
     <pubDate>Wed, 06 Aug 2003 15:16:52 +0000</pubDate>
 <dc:creator>m3rajk</dc:creator>
 <guid isPermaLink="false">comment 1135754 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/file-upload-issue#comment-1135748</link>
    <description> &lt;p&gt;look up a post. &lt;img src=&quot;https://www.webmaster-forums.net/misc/smileys/wink.png&quot; title=&quot;Wink&quot; alt=&quot;Wink&quot; class=&quot;smiley-content&quot; /&gt; &lt;/p&gt;
&lt;p&gt;those will get you the image types, not the extensions.&lt;/p&gt;
 </description>
     <pubDate>Wed, 06 Aug 2003 14:55:06 +0000</pubDate>
 <dc:creator>Suzanne</dc:creator>
 <guid isPermaLink="false">comment 1135748 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/file-upload-issue#comment-1135746</link>
    <description> &lt;p&gt;the problem with checking the extension instead is something i discovered elsewhere.... namely in dealing with less computer competent friends....&lt;/p&gt;
&lt;p&gt;turns out there&#039;s a good deal of people that think changing the extension to .jpg will magically encode a file to jpeg format.&lt;/p&gt;
&lt;p&gt;and searching &#039;photoname.extension&#039; is bad because it&#039;s valid to have &#039;photoname.date.extension&#039; and i for one do that....but like i said, both methods fail due to the stupidity of the genereal human populace.&lt;/p&gt;
&lt;p&gt;at p2p.wrox someoen pointed out thatdepending ont he browser/os it can be image/jpg image/jpeg image/pjpeg&lt;br /&gt;
i didn&#039;t realize that. and the person said that&#039;s all he knows and also pointed out the browser wont always guess even if i have the encryption/multipart form data tag in my form call.&lt;/p&gt;
&lt;p&gt;this begs the question: anyone know how to parse the begining of an image file? it&#039;ll def be a lot, but it&#039;ll also be a way around the human stupidity factor. &lt;/p&gt;
&lt;p&gt;for those with less diverse os experience, windows is the ONLY os that relies on extension to tell file type. ALL other operating systems i have ever used do that by the header of the file. thus if i knew how to parse the begining of pictures files in ascii, i could check that (using the tmp name) and get the type from there. and this is something i would def send to php.net because i&#039;m SURE that anyone else making a site where people upload pics that they want to restrict to a certain type would want to use this function.&lt;/p&gt;
&lt;p&gt;anyone wanna help me with that?&lt;/p&gt;
 </description>
     <pubDate>Wed, 06 Aug 2003 14:45:06 +0000</pubDate>
 <dc:creator>m3rajk</dc:creator>
 <guid isPermaLink="false">comment 1135746 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/file-upload-issue#comment-1135696</link>
    <description> &lt;p&gt;eregi(&#039;^image/p?jpeg(;.*)?$&#039;, $_FILES[&#039;uploadedfile&#039;][&#039;type&#039;])&lt;/p&gt;
&lt;p&gt;eregi(&#039;^image/gif(;.*)?$&#039;, $_FILES[&#039;uploadedfile&#039;][&#039;type&#039;])&lt;/p&gt;
 </description>
     <pubDate>Tue, 05 Aug 2003 17:12:20 +0000</pubDate>
 <dc:creator>Suzanne</dc:creator>
 <guid isPermaLink="false">comment 1135696 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/file-upload-issue#comment-1135694</link>
    <description> &lt;p&gt;When in doubt, print it out.&lt;br /&gt;
&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;&lt;span style=&quot;color: #000000&quot;&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;&amp;lt;?php&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;if(&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&#039;image/jpeg&#039;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;!==&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$_FILES&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$key&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;][&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&#039;type&#039;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;]){ &lt;/span&gt;&lt;span style=&quot;color: #FF8000&quot;&gt;# only accept jpegs&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$picerr&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;TRUE&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;; &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$warn&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;TRUE&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$warns&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;[]=\&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&quot;Your &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$value&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt; was not a JPEG. JPEG encoded filestraditionally end&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; with .jpe, .jpg, and .jpeg on windows.\&quot;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo \&quot;&amp;lt;br /&amp;gt;\n&amp;lt;b&amp;gt;Image Type: \&quot;.&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$_FILES&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$key&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;[&#039;type&#039;].\&quot;&amp;lt;br /&amp;gt;\n\&quot;;&lt;br /&gt;} &lt;br /&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;/p&gt;
 </description>
     <pubDate>Tue, 05 Aug 2003 16:50:54 +0000</pubDate>
 <dc:creator>Mark Hensler</dc:creator>
 <guid isPermaLink="false">comment 1135694 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/file-upload-issue#comment-1135689</link>
    <description> &lt;p&gt;Oooooh, calm down! &lt;img src=&quot;https://www.webmaster-forums.net/misc/smileys/big.png&quot; title=&quot;Laughing out loud&quot; alt=&quot;Laughing out loud&quot; class=&quot;smiley-content&quot; /&gt;&lt;br /&gt;
The answer is there, you just need to have the patience to see it.&lt;/p&gt;
 </description>
     <pubDate>Tue, 05 Aug 2003 15:36:16 +0000</pubDate>
 <dc:creator>JeevesBond</dc:creator>
 <guid isPermaLink="false">comment 1135689 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/file-upload-issue#comment-1135684</link>
    <description> &lt;p&gt;&lt;del&gt;&lt;strong&gt; i would prefer to know how it denotes them than to have someone fix the code, because by being told how it denotes them i can avoid this problem in the future &lt;/strong&gt;&lt;/del&gt;&lt;/p&gt;
 </description>
     <pubDate>Tue, 05 Aug 2003 14:54:22 +0000</pubDate>
 <dc:creator>m3rajk</dc:creator>
 <guid isPermaLink="false">comment 1135684 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/serverside-scripting/file-upload-issue#comment-1135617</link>
    <description> &lt;p&gt;I skipped the method and used this, it worked more exact for me, I had similar issues&lt;/p&gt;
&lt;p&gt;$imagesize = getimagesize($source);&lt;br /&gt;
	switch ($imagesize[2] ){&lt;br /&gt;
	case 0:&lt;br /&gt;
		$errorm .= &quot;Invalid File Type for Screen&quot;;&lt;br /&gt;
		$eflag = true;&lt;br /&gt;
		break;&lt;br /&gt;
	case 1:&lt;br /&gt;
		$file = $imgname . &#039;.gif&#039;;&lt;br /&gt;
		$eflag = false;&lt;br /&gt;
		break;&lt;br /&gt;
	case 2:&lt;br /&gt;
		$file = $imgname . &#039;.jpg&#039;;&lt;br /&gt;
		$eflag = false;&lt;br /&gt;
		break;&lt;br /&gt;
	case 3:&lt;br /&gt;
		$errorm .= &quot;Invalid File Type for Screen&quot;;&lt;br /&gt;
		$eflag = true;&lt;br /&gt;
		break;&lt;br /&gt;
	}&lt;/p&gt;
&lt;p&gt;the $source is from $_FILES[&#039;fieldname&#039;][&#039;tmp_name&#039;].&lt;/p&gt;
&lt;p&gt;If you dont want to use that method, check your encryption type and make sure the form tag has this ENCTYPE=&quot;multipart/form-data&lt;/p&gt;
 </description>
     <pubDate>Mon, 04 Aug 2003 20:24:22 +0000</pubDate>
 <dc:creator>ShaneS</dc:creator>
 <guid isPermaLink="false">comment 1135617 at https://www.webmaster-forums.net</guid>
  </item>
  </channel>
</rss>
