Jump to content

[SOLVED] file uploading


emtec

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.