<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xml:base="https://www.webmaster-forums.net/crss/node/1016991" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title></title>
    <link>https://www.webmaster-forums.net/crss/node/1016991</link>
    <description></description>
    <language>en</language>
          <item>
    <title></title>
    <link>https://www.webmaster-forums.net/web-database-development/storing-images-folder-managed-mysql#comment-1098917</link>
    <description> &lt;p&gt;Hello.&lt;/p&gt;
&lt;p&gt;Here is the mysql dump file. &lt;/p&gt;
&lt;p&gt;:&lt;/p&gt;
&lt;p&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;CREATE TABLE content &lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;(&lt;br /&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;id mediumint&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;8&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;) &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;NOT NULL auto_increment&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;,&lt;br /&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;category tinyint&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;4&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;) DEFAULT &lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&#039;0&#039;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;,&lt;br /&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;date timestamp&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;14&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;),&lt;br /&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;body_text text NOT NULL&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;,&lt;br /&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;title tinytext NOT NULL&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;,&lt;br /&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;binary_file blob NOT NULL&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;,&lt;br /&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;PRIMARY KEY &lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;)&lt;br /&gt;);&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;How can we add a table to it that will store the location of a file, and be accesed again to be viewed in html or php code, uploaded and stored via the following php code, but not currently the technique used to upload the image]:&lt;/p&gt;
&lt;p&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;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;if (&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;is_uploaded_file&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$userfile&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;copy&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$userfile&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;, \&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&quot;C:\apache\htdocs\file\\&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;);&lt;br /&gt;} else {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo \&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&quot;Possible file upload attack\: filename &#039;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$userfile&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&#039;\&quot;;&lt;br /&gt;}&lt;br /&gt;/* ...or... */&lt;br /&gt;move_uploaded_file(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$userfile&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;, \&quot;C:\apache\htdocs\file\\&quot;&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;);&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;in such a way that it is processed through mysql, but the image is stored in a folder on the server, and not directly in the mysql database itself. So that only the location of the image on the server is stored in mysql automatically,&lt;/p&gt;
&lt;p&gt;The image is currently called using code like:&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;http://www.domain.com/graphic_view.php?id=4&quot; class=&quot;bb-url&quot;&gt;domain.com/graphic_view.php?id=4&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;where id=4 is the id of the binary file stored in the mysql database.&lt;/p&gt;
&lt;p&gt;At the moment the file is drectly stored and not some folder using the following code:&lt;/p&gt;
&lt;p&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;$query &lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;= \&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&quot;INSERT INTO &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$user_tablename&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt; VALUES(NULL,&#039;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$category&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&#039;, NULL,&#039;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$enabled_url_text&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&#039;, &#039;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$title&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&#039;, &#039;&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$imagedata&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&#039;)\&quot;;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$result&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt; = mysql_query(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$query&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(!&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$result&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;) error_message(sql_error());&lt;br /&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;/p&gt;
&lt;p&gt;and is displayed using the code [in the graphic_view.php file which is used to display the image at the moment]:&lt;/p&gt;
&lt;p&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;while (&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$row&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;=&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;mysql_fetch_array&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$news_query&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;)){&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$idnum&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$row&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;[ \&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;&quot;id\&quot;];&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$graphic&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #0000BB&quot;&gt;$row&lt;/span&gt;&lt;span style=&quot;color: #007700&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #DD0000&quot;&gt; \&quot;binary_file\&quot;];&lt;br /&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/div&gt;&lt;br /&gt;
Any ideas? Again, short of it, currently the image is directly stored in the mysql database, and I want only the image location to be stored in the mysql database, and image stored in a folder?&lt;/p&gt;
&lt;p&gt;Thanks.&lt;/p&gt;
 </description>
     <pubDate>Mon, 21 Jan 2002 08:24:17 +0000</pubDate>
 <dc:creator>Zain</dc:creator>
 <guid isPermaLink="false">comment 1098917 at https://www.webmaster-forums.net</guid>
  </item>
  </channel>
</rss>
