I am trying to add an image upload to my current form for the news area of a site. I have sucessfully completed the form and connexcted it to the Mysql database and the information is stored sucessfully apart from the image.

I want to find out how i can upload the image to a folder in location www.mysite.com/vault/news and then how i store the image path in the database.

the database fields are as follows:

story_no int(11) auto_increment

title varchar(40)
story text
summary varchar(100)
link varchar(50)
image varchar(40)
date varchar(20)

The code for the form is as follows

<form action="" method="post" enctype="multipart/form-data" name="form1">
        <table align="center">
          <tr valign="baseline">
            <td align="right" valign="top" nowrap>Title:</td>
            <td align="left" valign="top"><input type="text" name="title" value="" size="32"> 
              <span class="admin_list">MAX 35 Characters </span></td>
          </tr>
          <tr valign="baseline">
            <td nowrap align="right" valign="top">Full Story:</td>
            <td align="left" valign="top"><textarea name="story" cols="80" rows="5"></textarea>
            </td>
          </tr>
          <tr valign="baseline">
            <td nowrap align="right" valign="top">Summary:</td>
            <td align="left" valign="top"><textarea name="summary" cols="80" rows="2"></textarea>
            </td>
          </tr>
          <tr valign="baseline">
            <td align="right" valign="top" nowrap>Link:</td>
            <td align="left" valign="top"><input type="text" name="link" size="32"> 
              <span class="admin_list">use www. format </span></td>
          </tr>
          <tr valign="baseline">
            <td align="right" valign="top" nowrap>Image:</td>
            <td align="left" valign="top"><input type="file" name="image" size="32"></td>
          </tr>
          <tr valign="baseline">
            <td align="right" valign="top" nowrap>Date:</td>
            <td align="left" valign="top"><input type="text" name="date" value="" size="32"> 
              <span class="admin_list">Date Format 00/00/00</span> </td>
          </tr>
          <tr valign="baseline">
            <td align="right" valign="top" nowrap>&nbsp;</td>
            <td align="left" valign="top"><input type="submit" value="Add News Story"></td>
          </tr>
        </table>
        <input type="hidden" name="story_no" value="">
        <input type="hidden" name="MM_insert" value="form1">
      </form>

Thanks in advance for your help

    Write a Reply...