pls i want how to upload and retrive only pdf files in php and mysql code or any links..
ratanji
0
Light Poster
Recommended Answers
Jump to Post<?php $targetPath = $_SERVER['DOCUMENT_ROOT'].'/upload/'; if (isset($_POST['submit'])){ $filename = basename( $_FILES['file']['name'], ".pdf"); if($_FILES['file']['type']=='application/pdf') { $filename = preg_replace("/[^A-Za-z0-9_-]/", "", $filename).".pdf"; $thumb = basename($filename, ".pdf"); $cpy=1; do { $targetFile = str_replace('//','/',$targetPath) ."Copy".$cpy. $filename; $filename="Copy".$cpy. $_FILES['file']['name']; $cpy++; }while(is_file($targetFile)); if(move_uploaded_file($_FILES['file']['tmp_name'], $targetPath.$filename)) { $pdfWithPath = $targetPath.$filename; echo "File Uploaded Successfully"; } } else …
All 2 Replies
Reply to this topic
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.