sandhya Posted March 25, 2009 Share Posted March 25, 2009 Hi all.., I"ve a form to upload images to a photo gallery. While uploading the image it didn't worked. I "ve tried to echo the image name. There i'm getting some path like this instead of getting the image name. photo=/tmp/php23PmhX What could be the problem. Please help me solving this problem.Thanks in advance. Quote Link to comment Share on other sites More sharing options...
hastishah Posted March 25, 2009 Share Posted March 25, 2009 Hi Can you post your code here between code tag. Quote Link to comment Share on other sites More sharing options...
sandhya Posted March 25, 2009 Author Share Posted March 25, 2009 <form action="fgallery.php" method="post" enctype="multipart/form-data" name="form1" id="form1" onsubmit="return validate(this);" > <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td width="30%" height="34"><div align="right" class="style5 style3 style8">News Category</div></td> <td width="5%"><div align="center" class="style5 style3 style8">:</div></td> <? $selcat=executework("select distinct subcategory,id from big_main where category='movie' order by id"); $cntcat=@mysql_num_rows($selcat); ?> <td width="65%"><div align="left" class="style7"> <select name="cat" id="cat"> <option value="SELECT CATEGORY" selected="selected">SELECT CATEGORY</option> <? while($rowcat=@mysql_fetch_array($selcat)) { if($rowcat[subcategory]!="") { ?> <option value="<? echo $rowcat[id] ?>" ><? echo $rowcat[subcategory] ?></option> <? } } ?> </select> </div></td> </tr> <tr> <td height="36"><div align="right" class="style5"> Head Line</div></td> <td><div align="center" class="style5">:</div></td> <td><div align="left"><span class="style3"><span class="style3"></span></span><span class="style7"> <input name="topic" type="text" id="topic" size="50" /> <span class="style8"> </span></span> </div> </td> </tr> <tr> <td height="38"><div align="right" class="style5"> Photo 1 </div></td> <td><div align="center" class="style5">:</div></td> <td><div align="left"><span class="style3"><span class="style3"><span class="style3"><span class="style8"><span class="style8"></span></span></span></span></span> <label> <input name="photos1" type="file" id="photos1" /> <input name="capt1" type="text" id="capt1" value="Caption Here........................." size="40" /> </label> </div></td> </tr> <tr> <td height="38"><div align="right" class="style5"> Photo 2 </div></td> <td><div align="center" class="style5">:</div></td> <td><div align="left"><span class="style3"><span class="style3"><span class="style3"><span class="style8"><span class="style8"></span></span></span></span></span> <label> <input name="photos2" type="file" id="photos2" /> </label> <input name="capt2" type="text" id="capt2" value="Caption Here........................." size="40" /> </div></td> </tr> <tr> <td height="36"><div align="right" class="style5"> Photo 3 </div></td> <td><div align="center" class="style5">:</div></td> <td><div align="left"><span class="style3"><span class="style3"><span class="style3"><span class="style8"><span class="style8"></span></span></span></span></span> <label> <input name="photos3" type="file" id="photos3" /> </label> <input name="capt3" type="text" id="capt3" value="Caption Here........................." size="40" /> </div></td> </tr> <tr> <td height="36"><div align="right" class="style5"> Photo 4 </div></td> <td><div align="center" class="style5">:</div></td> <td><div align="left"><span class="style3"><span class="style3"><span class="style3"><span class="style8"><span class="style8"></span></span></span></span></span> <label> <input name="photos4" type="file" id="photos4" /> </label> <input name="capt4" type="text" id="capt4" value="Caption Here........................." size="40" /> </div></td> </tr> <tr> <td height="27"><div align="right" class="style5"> Photo 5 </div></td> <td><div align="center" class="style5">:</div></td> <td><div align="left"><span class="style3"><span class="style3"><span class="style3"><span class="style8"><span class="style8"></span></span></span></span></span> <label> <input name="photos5" type="file" id="photos5" /> </label> <input name="capt5" type="text" id="capt5" value="Caption Here........................." size="40" /> </div></td> </tr> <tr> <td height="27" colspan="3"><div align="left"><span class="style3"><span class="style3"><span class="style3"><span class="style8"><span class="style8"></span></span></span></span></span> <label></label> </div></td> </tr> <tr> <td height="43" colspan="3"><div align="center"><span class="style3"><span class="style3"></span></span> <input type="submit" name="Submit" value="Submit" /> </div> <div align="center"><span class="style3"><span class="style3"></span></span></div> <div align="left"><span class="style3"><span class="style3"></span></span></div></td> </tr> <tr> <td><div align="right"><span class="style3"><span class="style3"></span></span></div></td> <td><div align="center"><span class="style3"><span class="style3"></span></span></div></td> <td><div align="left"><span class="style3"><span class="style3"></span></span></div></td> </tr> </table> </form> This is the form i created. Using this i'm trying to upload photos. After submitting the form photos are not posting properly. Is there any error in the form? Quote Link to comment Share on other sites More sharing options...
sandhya Posted March 25, 2009 Author Share Posted March 25, 2009 Please anybody help me. Quote Link to comment Share on other sites More sharing options...
hastishah Posted March 25, 2009 Share Posted March 25, 2009 Hi Go the page you are submitting the data. and just write the below lines. for file uploading you should use $_FILES array; echo '<pre>'; print_r($_POST); print_r($_FILES); die; you will all files value in $_FILES array; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.