camccall Posted December 10, 2007 Share Posted December 10, 2007 I'm writing a script that will run on my local system and run an action on a file on the system. It's just a test bed for another program I'm trying to work on. I'm trying to specify a file using the full path but for some reason, when I use the <input type="file"> I am only getting the file name. Here is the form code <form enctype="multipart/form-data" name="submit" action="submit.php" method="post"> <p><input type="file" name="mp3_file"/></p> <p><input type="submit" value="submit song"/></p> </form> When I submit this with /home/conner/file in the input field and run print_r($_FILES); the output I get is this: Array ( [mp3_file] => Array ( [name] => file [type] => application/octet-stream [tmp_name] => /tmp/phpVeKAoB [error] => 0 => 5665 ) ) Am I missing something here, shouldn't $_FILES[mp3_file][name] include the full path. Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted December 10, 2007 Share Posted December 10, 2007 The path on the client's computer only has meaning to the browser. After the file has been uploaded to the server, that information is irrelevant, not to mention that it is not available because it would expose client side information. Quote Link to comment Share on other sites More sharing options...
camccall Posted December 10, 2007 Author Share Posted December 10, 2007 Wow, I was completely confused. Here I thought that the form element just provided the path and then you had to initiate the upload to the server. I don't know what I was thinking that would be a terrible security flaw. Sorry for wasting your time. 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.