dflow Posted February 26, 2011 Share Posted February 26, 2011 im doing smting basically wrong <form action="" method="post"> <?php $x=1; $images = $_GET['images']; for( $i=0; $i<$images; $i++ ) { echo '<input name="ID" type="hidden" value="1234" /> <br> <input name="ImageURL['.$i.']" type="file" value=""/><br><br>'; } ?> <input name="submit" type="submit" /> <?php $con = mysql_connect("localhost","root","root"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_query("SET NAMES 'utf8'"); mysql_select_db("international", $con); if (isset($_POST['submit'])) for( $i=0; $i<$images; $i++ ) { $query=mysql_query("INSERT INTO images (ID,ImageURL) VALUES ('$_POST[iD]','$_POST[imageURL]')"); exit; mysql_close($con); } ?></form> Quote Link to comment Share on other sites More sharing options...
dflow Posted February 26, 2011 Author Share Posted February 26, 2011 a bit more code <form action="" method="post"> <?php $x=1; $images = $_GET['images']; for( $i=0; $i<$images; $i++ ) { echo '<input name="ID" type="hidden" value="1234" /> <br> <input name="ImageURL['.$i.']" type="file" value="" /><br><br>'; } ?> <input name="submit" type="submit" /> <?php $con = mysql_connect("localhost","root","root"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_query("SET NAMES 'utf8'"); mysql_select_db("international", $con); if (isset($_POST['submit'])) for( $i=0; $i<$images; $i++ ) { // Where the file is going to be placed $target_path = "uploads/"; /* Add the original filename to our target path. Result is "uploads/filename.extension" */ $target_path = $target_path . basename( $_FILES['ImageURL['.$i.']']['name']); $query=mysql_query("INSERT INTO images (ID,ImageURL) VALUES ('$_POST[iD]','$_FILES')"); exit; mysql_close($con); } var_dump($_POST); ?> </form> Quote Link to comment Share on other sites More sharing options...
litebearer Posted February 27, 2011 Share Posted February 27, 2011 If you are seeking to upload files - your form is missing - enctype="multipart/form-data" http://www.tizag.com/phpT/fileupload.php 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.