<?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: Oracle LOB Processing</title>
	<atom:link href="http://blog.mclaughlinsoftware.com/php-programming/oracle-lob-processing/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.mclaughlinsoftware.com</link>
	<description>Michael McLaughlin's Technical Blog</description>
	<lastBuildDate>Fri, 12 Mar 2010 07:01:32 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: maclochlainn</title>
		<link>http://blog.mclaughlinsoftware.com/php-programming/oracle-lob-processing/comment-page-1/#comment-17268</link>
		<dc:creator>maclochlainn</dc:creator>
		<pubDate>Sat, 27 Feb 2010 19:56:36 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mclaughlinsoftware.com/?page_id=2689#comment-17268</guid>
		<description>I&#039;ve updated the code to PHP 5.3 and added all components in drop down text. The zip files aren&#039;t yet updated but when I fix them, I&#039;ll update this comment.</description>
		<content:encoded><![CDATA[<p>I&#8217;ve updated the code to PHP 5.3 and added all components in drop down text. The zip files aren&#8217;t yet updated but when I fix them, I&#8217;ll update this comment.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Moe</title>
		<link>http://blog.mclaughlinsoftware.com/php-programming/oracle-lob-processing/comment-page-1/#comment-6805</link>
		<dc:creator>Moe</dc:creator>
		<pubDate>Fri, 10 Jul 2009 05:16:50 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mclaughlinsoftware.com/?page_id=2689#comment-6805</guid>
		<description>SWEEEEET!!!!

It is working!!!

Thanks!</description>
		<content:encoded><![CDATA[<p>SWEEEEET!!!!</p>
<p>It is working!!!</p>
<p>Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: maclochlainn</title>
		<link>http://blog.mclaughlinsoftware.com/php-programming/oracle-lob-processing/comment-page-1/#comment-6804</link>
		<dc:creator>maclochlainn</dc:creator>
		<pubDate>Fri, 10 Jul 2009 05:08:35 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mclaughlinsoftware.com/?page_id=2689#comment-6804</guid>
		<description>You need to call the URL not a file reference, change it to &lt;code&gt;http://localhost/lob/webcode/UploadItemBlobForm.htm&lt;/code&gt; and it should work. When you attempt to open a PHP file with:

&lt;a href=&quot;http://blog.mclaughlinsoftware.com/wp-content/uploads/2009/07/phpfileurl.png&quot; rel=&quot;nofollow&quot;&gt;&lt;img src=&quot;http://blog.mclaughlinsoftware.com/wp-content/uploads/2009/07/phpfileurl.png&quot; alt=&quot;phpfileurl&quot; title=&quot;phpfileurl&quot; style=&quot;border:none&quot; width=&quot;395&quot; height=&quot;21&quot; class=&quot;aligncenter size-full wp-image-2841&quot; /&gt;&lt;/a&gt;

It should output what you got. The reason is that the URL (URI) is passed by the Apache server to the Zend Server, which then interprets the PHP. That can&#039;t happen if you attempt to open it as a local file. Also, the code is written to use a POST method. That means you should call the form, which then calls the PHP code through a POST method operation, like:

&lt;pre lang=&quot;TEXT&quot;&gt;
&lt;form id=&quot;uploadForm&quot;
      action=&quot;UploadItemBlob.php&quot;
      enctype=&quot;multipart/form-data&quot;
      method=&quot;post&quot;&gt;
&lt;/pre&gt;

This should fix the problem. Let&#039;s hope. :-)</description>
		<content:encoded><![CDATA[<p>You need to call the URL not a file reference, change it to <code><a href="http://localhost/lob/webcode/UploadItemBlobForm.htm" rel="nofollow">http://localhost/lob/webcode/UploadItemBlobForm.htm</a></code> and it should work. When you attempt to open a PHP file with:</p>
<p><a href="http://blog.mclaughlinsoftware.com/wp-content/uploads/2009/07/phpfileurl.png" rel="nofollow"><img src="http://blog.mclaughlinsoftware.com/wp-content/uploads/2009/07/phpfileurl.png" alt="phpfileurl" title="phpfileurl" style="border:none" width="395" height="21" class="aligncenter size-full wp-image-2841" /></a></p>
<p>It should output what you got. The reason is that the URL (URI) is passed by the Apache server to the Zend Server, which then interprets the PHP. That can&#8217;t happen if you attempt to open it as a local file. Also, the code is written to use a POST method. That means you should call the form, which then calls the PHP code through a POST method operation, like:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">&lt;form id=&quot;uploadForm&quot;
      action=&quot;UploadItemBlob.php&quot;
      enctype=&quot;multipart/form-data&quot;
      method=&quot;post&quot;&gt;</pre></div></div>

<p>This should fix the problem. Let&#8217;s hope. <img src='http://blog.mclaughlinsoftware.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Moe</title>
		<link>http://blog.mclaughlinsoftware.com/php-programming/oracle-lob-processing/comment-page-1/#comment-6803</link>
		<dc:creator>Moe</dc:creator>
		<pubDate>Fri, 10 Jul 2009 04:58:19 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mclaughlinsoftware.com/?page_id=2689#comment-6803</guid>
		<description>Wow, thanks.

Moving the temp directory from being even with the folder containing the php to beneath it helped out. I now see the text after I load the text, and the text file is in the temp folder, but the image is still having trouble. It now displays this:

&lt;a href=&quot;http://blog.mclaughlinsoftware.com/wp-content/uploads/2009/07/phpfileread.png&quot; rel=&quot;nofollow&quot;&gt;&lt;img src=&quot;http://blog.mclaughlinsoftware.com/wp-content/uploads/2009/07/phpfileread.png&quot; alt=&quot;phpfileread&quot; title=&quot;phpfileread&quot; style=&quot;border:none&quot; width=&quot;400&quot; height=&quot;440&quot; class=&quot;aligncenter size-full wp-image-2839&quot; /&gt;&lt;/a&gt;</description>
		<content:encoded><![CDATA[<p>Wow, thanks.</p>
<p>Moving the temp directory from being even with the folder containing the php to beneath it helped out. I now see the text after I load the text, and the text file is in the temp folder, but the image is still having trouble. It now displays this:</p>
<p><a href="http://blog.mclaughlinsoftware.com/wp-content/uploads/2009/07/phpfileread.png" rel="nofollow"><img src="http://blog.mclaughlinsoftware.com/wp-content/uploads/2009/07/phpfileread.png" alt="phpfileread" title="phpfileread" style="border:none" width="400" height="440" class="aligncenter size-full wp-image-2839" /></a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: maclochlainn</title>
		<link>http://blog.mclaughlinsoftware.com/php-programming/oracle-lob-processing/comment-page-1/#comment-6800</link>
		<dc:creator>maclochlainn</dc:creator>
		<pubDate>Fri, 10 Jul 2009 04:38:53 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mclaughlinsoftware.com/?page_id=2689#comment-6800</guid>
		<description>If there&#039;s nothing in the &lt;code&gt;temp&lt;/code&gt; directory, then the database hasn&#039;t been touched. The &lt;code&gt;process_uploaded_file()&lt;/code&gt; function takes the uploaded file and moves it from the temporary cache to the &lt;code&gt;temp&lt;/code&gt; directory.

In your environment, this appears to not be working. This happens before any database activity. Is the &lt;code&gt;temp&lt;/code&gt; directory a subdirectory of the directory where you&#039;ve placed the PHP code? If not, you&#039;d get this error unless you rewrite the function provided. I did it that way so that it would work on Linux/Unix or Windows systems. Please let me know if I can help more.

&lt;pre lang=&quot;PHP&quot;&gt;
  function process_uploaded_file()
  {
    // Declare a variable for file contents.
    $contents = &quot;&quot;;
    
    // Define the upload file name for Windows or Linux.
    if (ereg(&quot;Win32&quot;,$_SERVER[&quot;SERVER_SOFTWARE&quot;]))
      $upload_file = getcwd().&quot;\\temp\\&quot;.$_FILES[&#039;userfile&#039;][&#039;name&#039;];
    else
      $upload_file = getcwd().&quot;/temp/&quot;.$_FILES[&#039;userfile&#039;][&#039;name&#039;];
      
    // Check for and move uploaded file.
    if (is_uploaded_file($_FILES[&#039;userfile&#039;][&#039;tmp_name&#039;]))
      move_uploaded_file($_FILES[&#039;userfile&#039;][&#039;tmp_name&#039;],$upload_file);
      
    // Open a file handle and suppress an error for a missing file.
    if ($fp = @fopen($upload_file,&quot;r&quot;))
    {
      // Read until the end-of-file marker.
      while (!feof($fp))
        $contents .= fgetc($fp);
      // Close an open file handle.
      fclose($fp);
    }
    // Return file content as string.
    return $contents;
  }
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>If there&#8217;s nothing in the <code>temp</code> directory, then the database hasn&#8217;t been touched. The <code>process_uploaded_file()</code> function takes the uploaded file and moves it from the temporary cache to the <code>temp</code> directory.</p>
<p>In your environment, this appears to not be working. This happens before any database activity. Is the <code>temp</code> directory a subdirectory of the directory where you&#8217;ve placed the PHP code? If not, you&#8217;d get this error unless you rewrite the function provided. I did it that way so that it would work on Linux/Unix or Windows systems. Please let me know if I can help more.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">  <span style="color: #000000; font-weight: bold;">function</span> process_uploaded_file<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">// Declare a variable for file contents.</span>
    <span style="color: #000088;">$contents</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">// Define the upload file name for Windows or Linux.</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">ereg</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Win32&quot;</span><span style="color: #339933;">,</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;SERVER_SOFTWARE&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
      <span style="color: #000088;">$upload_file</span> <span style="color: #339933;">=</span> <span style="color: #990000;">getcwd</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\\</span>temp<span style="color: #000099; font-weight: bold;">\\</span>&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$_FILES</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'userfile'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">else</span>
      <span style="color: #000088;">$upload_file</span> <span style="color: #339933;">=</span> <span style="color: #990000;">getcwd</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;/temp/&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$_FILES</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'userfile'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">// Check for and move uploaded file.</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">is_uploaded_file</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_FILES</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'userfile'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'tmp_name'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
      <span style="color: #990000;">move_uploaded_file</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_FILES</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'userfile'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'tmp_name'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span><span style="color: #000088;">$upload_file</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">// Open a file handle and suppress an error for a missing file.</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span> <span style="color: #339933;">=</span> <span style="color: #339933;">@</span><span style="color: #990000;">fopen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$upload_file</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;r&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
      <span style="color: #666666; font-style: italic;">// Read until the end-of-file marker.</span>
      <span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">feof</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span>
        <span style="color: #000088;">$contents</span> <span style="color: #339933;">.=</span> <span style="color: #990000;">fgetc</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #666666; font-style: italic;">// Close an open file handle.</span>
      <span style="color: #990000;">fclose</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #666666; font-style: italic;">// Return file content as string.</span>
    <span style="color: #b1b100;">return</span> <span style="color: #000088;">$contents</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span></pre></div></div>

]]></content:encoded>
	</item>
	<item>
		<title>By: Moe</title>
		<link>http://blog.mclaughlinsoftware.com/php-programming/oracle-lob-processing/comment-page-1/#comment-6796</link>
		<dc:creator>Moe</dc:creator>
		<pubDate>Fri, 10 Jul 2009 02:26:14 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mclaughlinsoftware.com/?page_id=2689#comment-6796</guid>
		<description>I&#039;m stumped.

I followed all the instructions, I checked the credentials, changed both db connection strings to &lt;code&gt;localhost/xe&lt;/code&gt;. There is nothing in the &lt;code&gt;temp&lt;/code&gt; directory. When I do a describe on the item table there is a zero in the &lt;code&gt;item_desc&lt;/code&gt; column, and nothing (null) in the &lt;code&gt;item_blob&lt;/code&gt; column.</description>
		<content:encoded><![CDATA[<p>I&#8217;m stumped.</p>
<p>I followed all the instructions, I checked the credentials, changed both db connection strings to <code>localhost/xe</code>. There is nothing in the <code>temp</code> directory. When I do a describe on the item table there is a zero in the <code>item_desc</code> column, and nothing (null) in the <code>item_blob</code> column.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael</title>
		<link>http://blog.mclaughlinsoftware.com/php-programming/oracle-lob-processing/comment-page-1/#comment-6416</link>
		<dc:creator>Michael</dc:creator>
		<pubDate>Wed, 01 Jul 2009 16:52:14 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mclaughlinsoftware.com/?page_id=2689#comment-6416</guid>
		<description>In ZEND I don&#039;t get any errors when I should. So I fixed it by changing a line in &lt;code&gt;php.ini&lt;/code&gt; file to say:

&lt;pre lang=&quot;BASH&quot;&gt;
display_errors = ON
&lt;/pre&gt;

This enables it because by default it is off.</description>
		<content:encoded><![CDATA[<p>In ZEND I don&#8217;t get any errors when I should. So I fixed it by changing a line in <code>php.ini</code> file to say:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">display_errors = ON</pre></div></div>

<p>This enables it because by default it is off.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: maclochlainn</title>
		<link>http://blog.mclaughlinsoftware.com/php-programming/oracle-lob-processing/comment-page-1/#comment-6378</link>
		<dc:creator>maclochlainn</dc:creator>
		<pubDate>Tue, 30 Jun 2009 22:05:30 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mclaughlinsoftware.com/?page_id=2689#comment-6378</guid>
		<description>I&#039;ll put the following query in the troubleshooting section but here it is. You use the &lt;code&gt;GETLENGTH&lt;/code&gt; function from the &lt;code&gt;DBMS_LOB&lt;/code&gt; package, like this:

&lt;pre lang=&quot;SQL&quot;&gt;
SELECT   i.item_id
,        dbms_lob.getlength(i.item_clob)
,        dbms_lob.getlength(i.item_blob)
FROM     item i
WHERE    i.item_desc IS NOT NULL
OR       i.item_blob IS NOT NULL;
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>I&#8217;ll put the following query in the troubleshooting section but here it is. You use the <code>GETLENGTH</code> function from the <code>DBMS_LOB</code> package, like this:</p>

<div class="wp_syntax"><div class="code"><pre class="sql" style="font-family:monospace;"><span style="color: #993333; font-weight: bold;">SELECT</span>   i<span style="color: #66cc66;">.</span>item_id
<span style="color: #66cc66;">,</span>        dbms_lob<span style="color: #66cc66;">.</span>getlength<span style="color: #66cc66;">&#40;</span>i<span style="color: #66cc66;">.</span>item_clob<span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">,</span>        dbms_lob<span style="color: #66cc66;">.</span>getlength<span style="color: #66cc66;">&#40;</span>i<span style="color: #66cc66;">.</span>item_blob<span style="color: #66cc66;">&#41;</span>
<span style="color: #993333; font-weight: bold;">FROM</span>     item i
<span style="color: #993333; font-weight: bold;">WHERE</span>    i<span style="color: #66cc66;">.</span>item_desc <span style="color: #993333; font-weight: bold;">IS</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span>
<span style="color: #993333; font-weight: bold;">OR</span>       i<span style="color: #66cc66;">.</span>item_blob <span style="color: #993333; font-weight: bold;">IS</span> <span style="color: #993333; font-weight: bold;">NOT</span> <span style="color: #993333; font-weight: bold;">NULL</span>;</pre></div></div>

]]></content:encoded>
	</item>
	<item>
		<title>By: michael</title>
		<link>http://blog.mclaughlinsoftware.com/php-programming/oracle-lob-processing/comment-page-1/#comment-6375</link>
		<dc:creator>michael</dc:creator>
		<pubDate>Tue, 30 Jun 2009 21:53:36 +0000</pubDate>
		<guid isPermaLink="false">http://blog.mclaughlinsoftware.com/?page_id=2689#comment-6375</guid>
		<description>how do I query to see if a blob is loaded in a column?</description>
		<content:encoded><![CDATA[<p>how do I query to see if a blob is loaded in a column?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
