gbuck Posted July 19, 2009 Share Posted July 19, 2009 I have a form with a <select> box that I populate with filenames from a folder on the server using PHP. I want to go to the Force Download dialog box when the submit button is clicked for the file the user has chosen in the drop-down box. My PHP skills (apart from the most basic uses) at this point involve a lot of hunting in books and online for code samples I can tweak. My problem is that every example I've seen of a force-download script requires the typed filename. It seems really simple but but I'm having trouble. Is the filename already passed as variable in the _POST array? I currently using a GET method for the form. Quote Link to comment https://forums.phpfreaks.com/topic/166524-solved-passing-chosen-filename-to-my-downloadphp/ Share on other sites More sharing options...
ignace Posted July 19, 2009 Share Posted July 19, 2009 Is the filename already passed as variable in the _POST array? I currently using a GET method for the form. Yes if you did used something like: <select name="filename"> <option value="a-filename.ext">Filename</option> </select> You can access it using: $_POST['filename'] /*or*/ $_GET['filename'] Depending on the request method you used. Quote Link to comment https://forums.phpfreaks.com/topic/166524-solved-passing-chosen-filename-to-my-downloadphp/#findComment-878209 Share on other sites More sharing options...
gbuck Posted July 19, 2009 Author Share Posted July 19, 2009 Thanks for your help... I seem to have gotten to the bottom of the filename, but now "file_exists" returns false. My new post (because I solved the filename issue): http://www.phpfreaks.com/forums/index.php/topic,261121.0.html Quote Link to comment https://forums.phpfreaks.com/topic/166524-solved-passing-chosen-filename-to-my-downloadphp/#findComment-878298 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.