How to get the full path in userfile?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
organizedchaos
Forum Newbie
Posts: 2
Joined: Thu Jun 18, 2009 3:23 pm

How to get the full path in userfile?

Post by organizedchaos »

Hi! Can anyone tell me how to get the whole path including the filename when I browse for a file? The file could be anywhere so I just couldn't add the path in my code.

This code only gives me the filename:

Code: Select all

$filename = $_FILES['userfile']['name'];
Thanks!
organizedchaos
Forum Newbie
Posts: 2
Joined: Thu Jun 18, 2009 3:23 pm

Re: How to get the full path in userfile?

Post by organizedchaos »

I see. :( Can you just suggest something to help me? What I'm trying to do is to convert word documents to html file. The class that I found requires the whole path or if the path isn't specified, it automatically searches for it in My Documents. My problem is what if the file isn't in my documents? I don't want to have to put all the files in My documents. :( And also there's nowhere in the code where it specified that it will search for the file in My Documents so meaning it's automatic and I can't change it?
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: How to get the full path in userfile?

Post by requinix »

...Huh?

If the file was uploaded then just feed it $_FILES[uploadname]["tmp_name"]. That's the full path of the file on your server.
(Unless you moved it, of course.)
Post Reply