ikon Posted February 27, 2008 Share Posted February 27, 2008 I am trying to add an image for a new category in my category however, its inputting all the information apart from the image location i have 2 pages, 1 the form to capture the data <?php session_start(); if(isset($_SESSION['username'])==false){ header("Location: ../index/ImprintablesHome.php"); exit(); } require "connect.php"; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Add a New Catagory</title> </head> <body> <form action="addnewcatagoryscript.php" method="get"> <table width="606" border="0"> <tr> <td>Caragory ID</td> <td><input name="cat_id" type="text" id="cat_id" value="<?php $cat_id?>" /></td> <td> </td> </tr> <tr> <td width="291"><label>Parent ID</label></td> <td width="166"><label> <input name="cat_parent_id" type="text" id="cat_parent_id" value="<?php $cat_parent_id?>" /> </label></td> <td width="135"> </td> </tr> <tr> <td>Catagory Name (Max 50 Characters)<br /> Eg Mouse Mat<br /> <br /></td> <td><label> <input name="cat_name" type="text" id="cat_name" value="<?php $cat_name?>" /> </label></td> <td> </td> </tr> <tr> <td><p>Catagory Description</p> </td> <td><label> <input name="cat_description" type="text" id="cat_description" value="<?php $cat_description?>" /> </label></td> <td> </td> </tr> <tr> <td>Catagory Image</td> <td><input name="cat_image" type="file" id="cat_image" value="<?php $cat_image?>" /></td> <td> </td> </tr> <tr> <td> </td> <td><label> <input type="submit" name="CatSubmit" id="CatSubmit" value="Submit New Catagory" /> </label></td> <td> </td> </tr> <tr> <td> </td> <td><label> <input type="reset" name="ClearForm" id="ClearForm" value="Clear Form" /> </label></td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> <td> </td> </tr> </table> </form> </body> </html> Link to comment https://forums.phpfreaks.com/topic/93334-help-inputting-image-into-a-database/ Share on other sites More sharing options...
ikon Posted February 27, 2008 Author Share Posted February 27, 2008 and page 2 checks the script however, its not letting me post it onto the forum! Link to comment https://forums.phpfreaks.com/topic/93334-help-inputting-image-into-a-database/#findComment-478052 Share on other sites More sharing options...
aschk Posted February 27, 2008 Share Posted February 27, 2008 Summate what you are doing: i.e. how you are using the $_FILES information. Link to comment https://forums.phpfreaks.com/topic/93334-help-inputting-image-into-a-database/#findComment-478076 Share on other sites More sharing options...
ikon Posted February 27, 2008 Author Share Posted February 27, 2008 by doing the following: function uploadImage($inputName, $uploadDir) { $cat_image = $_FILES[$inputName]; $imagePath = ''; For some reason this forum isnt letting me post up all the code.... Link to comment https://forums.phpfreaks.com/topic/93334-help-inputting-image-into-a-database/#findComment-478082 Share on other sites More sharing options...
aschk Posted February 27, 2008 Share Posted February 27, 2008 Is it the case that the image location is not being put into the database? Or that the image is not displaying when the information is pulled back from the database later? Are you using move_uploaded_file() to put the file in the right directory, and if so is this functioning properly. What is your SQL statement, and your database layout? Link to comment https://forums.phpfreaks.com/topic/93334-help-inputting-image-into-a-database/#findComment-478093 Share on other sites More sharing options...
ikon Posted February 28, 2008 Author Share Posted February 28, 2008 fixed - it was due to a capital letter in the wrong place - 7hours later! dont you just LOVE PHP! Link to comment https://forums.phpfreaks.com/topic/93334-help-inputting-image-into-a-database/#findComment-478653 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.