idontknowphp Posted April 30, 2011 Share Posted April 30, 2011 I am very new to php and am trying to create a simple application that uploads a PDF file to a database. I have one field for the Volume Number and on file field for the PDF to be uploaded. My issue is i can't get the PDF to upload or insert the name of the pdf (eg volume1.pdf) into the data base. I would also like to point out that I know i have a low post count, but i only seek help when i truly need it and have exhausted all other resources... Here is what i have, please go easy on me this is my first round at php: <?php if(isset($_POST['submit'])){ $vol_num = $_POST['vol_num']; $pdf = $_FILES['pdf']['name']; $path = '../pdf/'.$_FILES['pdf']['name']; move_uploaded_file($_FILES["pdf"]["tmp_name"], $path); mysql_query("INSERT INTO volumes set vol_num='$vol_num', vol_link='$pdf'") or die (mysql_error()); echo "<script>location.href='add_volume.php'</script>"; } ?> what am i doing wrong here? Thanks in advance Quote Link to comment https://forums.phpfreaks.com/topic/235229-having-trouble-uploading-a-file-to-databasemysql-easy-question/ Share on other sites More sharing options...
idontknowphp Posted May 1, 2011 Author Share Posted May 1, 2011 edit: sorry, i did not solve this as originally thought....turns out i fixed the file not uploading however the name is not being set in the database. Quote Link to comment https://forums.phpfreaks.com/topic/235229-having-trouble-uploading-a-file-to-databasemysql-easy-question/#findComment-1208843 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.