View Single Post
  #1 (permalink)  
Old Apr 13th, 2008, 15:00
markusdavid markusdavid is offline
Junior Member
Join Date: Aug 2007
Location: London
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
upload images through updating a form

Dear all,

I have created a form to edit existing data in my database. It works fine, however I need to update an image. The updating of the image name in the database works fine, but I need to write the image onto the server into an image folder so that it displays it on the webpage, but this isn’t working. Could anyone check my code and let me know what I should do?
Thanks
Mark

Code: Select all
   
  <form method="post" action="updated.php">
  <table>
  <col span="1" align="right">
  <tr>
  <td><?php Echo "<img src=http://www.domainname.com/images/".$formVars['photo'] ."> "; ?></td>
  </tr>
  <tr>
  <td>id:</td>
  <td><? echo $formVars["id"]; ?></td>
  </tr>
  <tr>
  <td>Name:</td>
  <td><input type="text" name="name"
  value="<? echo $formVars["name"]; ?>" size=40 maxlength=30></td>
  </tr>
  <tr>
  <td>Photo:</td>
  <td><input type="file" name="photo" 
  value="<? echo $formVars["photo"]; ?>" size=40 maxlength=30></td>
  </tr>
  <form enctype="multipart/form-data" action="updated.php" method="POST">
  <input name="id" type="hidden" value="<?=$formVars[id]?>" />
  <input name="submit" type="submit" value="Submit" /></form></td>
  </tr>

Last edited by saltedm8; Apr 17th, 2008 at 17:29. Reason: added [code] tags
Reply With Quote