affordit Posted December 3, 2008 Share Posted December 3, 2008 Trying to use the script below to upload pictures to mysql DB. The variable is not getting passed to the next page. Can anyone help, what am I missing? This is the form: <form action=submit_pic.php method='POST' enctype='multipart/form-data'> <table> <tr> <td>Choose a file</td><td align='left'><INPUT TYPE='file' NAME='img1' SIZE='30'></td> </tr> <tr> <td colspan='2' align='center'><input type=submit name='Submit' value='ADD'></td> </tr> </table> </form> This is the next page: <?php include("teao_1_dbinfo2.inc"); if ($img1_name != "") { $img2_name = ("$img1_name"); @copy("$img1" , "$main_dir/$img2_name") or die("Couldn't Upload Your File."); } else { echo ""; } if ($img2_name == "") {$img2_name = 'no.jpg';} if ($img2_name != "") {$pic1 = "<img src=uploads/$img2_name width=320 height=200>";} if ($link == "") {$link = '';} {$pic = "$pic1";} if ($link != "") {$pic = "<a href=http://$link target=_blank>$pic1</a>";} if ($img2_name == "") {$pic1 = '';} ?> <?php include("conn.inc"); mysql_query ("INSERT INTO pics (id, picture) VALUES ('', '$pic') "); print ("<p>"); print ($pic); if ($img1_name != "") { echo "<H1>File Upload Successful!</H1><br><P>Successfully Sent: $img2_name, a $img2_size byte file with the extension type of $img2_type </P>"; } else { echo ""; } ?> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/135260-solved-problems-uploading-pictures-to-database/ Share on other sites More sharing options...
.josh Posted December 3, 2008 Share Posted December 3, 2008 handling file uploads Quote Link to comment https://forums.phpfreaks.com/topic/135260-solved-problems-uploading-pictures-to-database/#findComment-704495 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.