chennaibala Posted November 13, 2009 Share Posted November 13, 2009 hi am upload image by using below html tag <input id="file1" type="text" value=0> <input id="file1" type="file" name="file[]" > <input id="file2" type="file" name="file[]" > <input id="file3" type="file" name="file[]" > <input type="submit" value="Send" /> <input id="file1" type="file" name="file[]" > upload image show path like C:\Documents and Settings\My Documents\My Pictures\images0056.jpg i need image name with extension like images0056.jpg etc from file[] insert in database. it must insert in these format value imagename ------- ----------- 0 image0056.jpg 0 image0057.jpg 0 image0058.jpg thanks in advance.. Quote Link to comment https://forums.phpfreaks.com/topic/181370-insert-in-mysql/ Share on other sites More sharing options...
PFMaBiSmAd Posted November 13, 2009 Share Posted November 13, 2009 You already have an existing thread where someone posted a link to the php.net manual that shows how you access the uploaded file information for multiple uploads - http://www.phpfreaks.com/forums/index.php/topic,276300.0.html Quote Link to comment https://forums.phpfreaks.com/topic/181370-insert-in-mysql/#findComment-956779 Share on other sites More sharing options...
chennaibala Posted November 13, 2009 Author Share Posted November 13, 2009 hi PFMaBiSmAd.. it is not problem of uploading..it problem inserting image name in that sql in that format... Quote Link to comment https://forums.phpfreaks.com/topic/181370-insert-in-mysql/#findComment-956831 Share on other sites More sharing options...
PFMaBiSmAd Posted November 13, 2009 Share Posted November 13, 2009 We would need to see your code in order to help you with what it is doing or not doing. Quote Link to comment https://forums.phpfreaks.com/topic/181370-insert-in-mysql/#findComment-956840 Share on other sites More sharing options...
chennaibala Posted November 19, 2009 Author Share Posted November 19, 2009 hi frd here coding for u...by using these code i can insert only first image i.e image0056.jpg,other imagename not inserted.wht may be probem?thanks in advances... for($i=1; $i<=3; $i++) { // $tmp_name= $_FILES["file"]["tmp_name"][$i]; $no = 0; $picname = $_FILES["file"]["name"][$i]; // echo $name; $sql1 = "INSERT INTO pictable(no, picname) VALUES('$no','$picname )"; mysql_query($sql1); mysql_query("COMMIT"); mysql_close($con); } Quote Link to comment https://forums.phpfreaks.com/topic/181370-insert-in-mysql/#findComment-960727 Share on other sites More sharing options...
mikesta707 Posted November 19, 2009 Share Posted November 19, 2009 your loop should probably be for ($i = 0; i < count($_FILES['file']['tmp_name']); $i++){ but beyond that I don't see much of a problem. Try echoing $picname in the loop and see what the variable holds Quote Link to comment https://forums.phpfreaks.com/topic/181370-insert-in-mysql/#findComment-960747 Share on other sites More sharing options...
chennaibala Posted November 19, 2009 Author Share Posted November 19, 2009 thanks mike...after the change ,now control is not going inside loop itself..$picname is not printed...wht may problem.. Quote Link to comment https://forums.phpfreaks.com/topic/181370-insert-in-mysql/#findComment-960766 Share on other sites More sharing options...
ghostcoder Posted November 19, 2009 Share Posted November 19, 2009 Try a print_r($_FILES) before your loop to get a peek inside the array... Quote Link to comment https://forums.phpfreaks.com/topic/181370-insert-in-mysql/#findComment-960771 Share on other sites More sharing options...
chennaibala Posted November 19, 2009 Author Share Posted November 19, 2009 where print_r($_FILES)?? Quote Link to comment https://forums.phpfreaks.com/topic/181370-insert-in-mysql/#findComment-960778 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.