awrobinson Posted July 6, 2008 Share Posted July 6, 2008 I'm brand new to PHP, working my way through "Learning PHP 5" by David Sklar. I am trying to web-ify a script that processes a log file. I need to input the filename of the log file. I am having trouble with the "file" input form tag. Boiled down, this is the form spec I tried first: <form action="fileform.php" method="POST"> <input type="file" name="logfile" size="30"> <input type="submit" name="submit" value="Submit"> <input type="hidden" name="_submit_check" value="1"> </form> I am checking the output of the form with this boiled down php code: <?php print_r($_POST); ?> The output I get is this: Array ( [logfile] => elisa.log [submit] => Submit [_submit_check] => 1 ) I get the filename, but not the path. I did a bit of research, and it was apparent I needed the "enctype" option for the form tag: <form action="fileform.php" method="POST" enctype="multipart/form-data"> However, when I run my test with this form tag, the results do not seem to even acknowledge the file input tag exists: Array ( [submit] => Submit [_submit_check] => 1 ) So my question is simple. What don't I know? Thanks! Andrew Robinson Link to comment https://forums.phpfreaks.com/topic/113492-solved-help-with-file-input-form-tag/ Share on other sites More sharing options...
ratcateme Posted July 6, 2008 Share Posted July 6, 2008 try reading this http://nz.php.net/features.file-upload info on uploaded files is stored in $_FILES here you will find info like where the temporary uploaded file is if any errors occurred and its size. Scott. Link to comment https://forums.phpfreaks.com/topic/113492-solved-help-with-file-input-form-tag/#findComment-583154 Share on other sites More sharing options...
awrobinson Posted July 10, 2008 Author Share Posted July 10, 2008 It took a couple of nights of playing to get the hang of the file upload mechanism, but I have a working script now. Thanks Scott! Link to comment https://forums.phpfreaks.com/topic/113492-solved-help-with-file-input-form-tag/#findComment-585964 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.