ksmatthews Posted December 17, 2007 Share Posted December 17, 2007 HI There, I am using the following HTML snippet to slect a file for upload .... <input class = "default" name="myfile" type="file" /> When I submit the form however, the file path (string) that was used to populate the text field simply disappears and I am unable to populate the DB. How can I capture it ? regards, Steven M Quote Link to comment Share on other sites More sharing options...
PHP_PhREEEk Posted December 17, 2007 Share Posted December 17, 2007 Give us more of the form to work with, tell us what you are typing into the form field, and then echo out the submitted variable via echo $_POST['myfile'] or print_r($_POST) PhREEEk Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted December 17, 2007 Share Posted December 17, 2007 The file path on the client's computer is private to the client's computer. It has no meaning on the server anyway. The file path on the server has nothing to do with the file path on the client where the file came from. Quote Link to comment Share on other sites More sharing options...
haku Posted December 17, 2007 Share Posted December 17, 2007 Add this to your <form> tag: enctype="multipart/form-data" But what you have to realize is that this wont populate your database, rather it will just upload the file onto your server. If you want to add the path name to your database you will have write a script for that as well. Quote Link to comment Share on other sites More sharing options...
ksmatthews Posted December 17, 2007 Author Share Posted December 17, 2007 HI Guys, Thanks for your advice. I realise now that I need to use $_FILES["myfile"]["name"] to accesss the file name, regards Steven M Quote Link to comment 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.