i want to add a form in a website (or in a wordpress page if there's a plugin) where there is a form where you enter a code (Example deJ9845) and click download and you download a file. is this difficult? anyone can help me ? thanks !
$code="deJ9845"; $file="file.txt"; $file_download = basename($file); if(isset($_POST['submit'])){ $code_input = $_POST['code']; if($code_input==$code){ header ("Content-Type: application/octet-stream"); header ("Accept-Ranges: bytes"); header ("Content-Length: ".filesize($file)); header ("Content-Disposition: attachment; filename=".$file_download); readfile($file); exit; } } PHP: <form action="" method="post" > <input type="text" name="code" /> <input type="submit" name="submit" value="Download" /> </form>
Hello No this is not hard at all. All you need to do is get the code from wherever it's made e.g. aweber and then choose a place on your page where you want to put it. You have to do so in the source code. If you're using wordpress click on the HTML tab and you will see the coding. Hope that helps. Karlene