emtec Posted September 13, 2008 Share Posted September 13, 2008 i'm trying to create a form to upload an image with some user info. everything is working except the file upload and filename in SQL db this is my code: $target_path = "../images/profile/"; $target_path = $target_path . basename( $_FILES['picture']['name']); $_FILES['picture']['tmp_name']; $file = $_FILES['picture']['name']; mysql_query("INSERT INTO blog_profile (name, about, image, password, level) VALUES ('$name', '$about', '$file', '$pass', '$level' )"); echo "<p>New user added, <a href='?action=manageuser'>back to user manager</a>".$file."</p>"; Add user <form action="<?php echo $PHP_SELF;?>" method="post" id="commentform"> <label for="author">Name</label><br><input type="text" name="name" id="name" value="" size="20" tabindex="1" /><br> <label for="author">Password</label><br><input type="password" name="pass" id="pass" value="" size="20" tabindex="1" /><br> <label for="author">Type</label><br> <SELECT NAME="level"> <OPTION VALUE='1' >Mod</OPTION>"; <OPTION VALUE='2' >Admin</OPTION>"; </SELECT><br> <label for="about">About</label><br> <textarea name="about" cols="59" rows="15"></textarea><br> Choose a picture to upload: <input name="picture" type="file" /><br> <br><input name="submit" type="submit" id="submit" tabindex="5" value="Add user" /> </form> thx Link to comment https://forums.phpfreaks.com/topic/124049-solved-file-uploading/ Share on other sites More sharing options...
ratcateme Posted September 13, 2008 Share Posted September 13, 2008 have a look at http://nz2.php.net/move_uploaded_file Scott. Link to comment https://forums.phpfreaks.com/topic/124049-solved-file-uploading/#findComment-640396 Share on other sites More sharing options...
emtec Posted September 13, 2008 Author Share Posted September 13, 2008 thx m8 didnt knew i had to add enctype='multipart/form-data' to the form tags Link to comment https://forums.phpfreaks.com/topic/124049-solved-file-uploading/#findComment-640401 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.