Jump to content

[SOLVED] $_FILES problem with full path


camccall

Recommended Posts

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. 

Link to comment
Share on other sites

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. 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.