Luqman Posted January 28, 2014 Share Posted January 28, 2014 how to use pdf files in php, which is where the calling file in mysql Link to comment Share on other sites More sharing options...
thescientist Posted January 28, 2014 Share Posted January 28, 2014 I'm not sure what you're asking for. Are you asking how to upload PDF files and store the file, or reference to the file in a database? If so, it's not much different than uploading any other file, of which there are numerous topics and tutorials on. http://www.w3schools.com/php/php_file_upload.asp https://www.google.com/search?q=fileupload+php&oq=fileupload+php&aqs=chrome..69i57j0l2.9605j0j7&sourceid=chrome&espv=210&es_sm=119&ie=UTF-8#q=fileupload+php&safe=off Link to comment Share on other sites More sharing options...
Luqman Posted January 29, 2014 Author Share Posted January 29, 2014 <?php $uploads_dir = '/opt/lampp/htdocs/magazine/upload'; foreach ($_FILES["pictures"]["error"] as $key => $error) { if ($error == UPLOAD_ERR_OK ) { $tmp_name = $_FILES["pictures"]["tmp_name"][$key]; $name = $_FILES["pictures"]["name"][$key]; move_uploaded_file($tmp_name, "$uploads_dir/$name"); } } ?> Notice: Undefined index: pictures in /opt/lampp/htdocs/magazine/upload.php on line 3Warning: Invalid argument supplied for foreach() in /opt/lampp/htdocs/magazine/upload.php This could be why the error? Link to comment Share on other sites More sharing options...
Ingolme Posted January 29, 2014 Share Posted January 29, 2014 Remember that the <form> element needs the enctype attribute to be set. Link to comment Share on other sites More sharing options...
thescientist Posted January 30, 2014 Share Posted January 30, 2014 what debugging are you doing? You can look in your browsers console / networks tab to see what is in the request, including any file data. You can also var_dump $_FILES to see exactly what is coming over the wire. When submitting issues that deal with both the front and back end, it is helpful, especially in this case, to post the form part of your code, as per Ingolme's post, you could have issues there as well. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now