file - How to find PHPs tmp folder relative to script running? -
Is it possible to find a PHP TMP folder on runtime?
I am uploading files and I am using it for:
$ _ files ['upfile'] ['tmp_name']
However, for one of the APIs I am using, it is necessary for me to give the full file path of the uploaded file relative to my script! It's a little annoying but will have to do it.
How can I do this but any thoughts?
Edit
I am currently doing this because I know how many levels can go up but I'm sure that the TMP folder is different for different servers May be on.
$ file = '../ ..' $ _ Files ['upfile'] ['tmp_name'];
thanks
Not sure that this is an easy way But it works on my server In addition, there is probably a way to change folder names .. but this is behind me.
$ folders = explode ('/', $ _SERVER ['SCRIPT_FILENAME']); For ($ i = 2; $ i & lt; Count ($ folder); $ i ++) $ dir = '../'; $ Dir = substr ($ dir, 0, -1); $ Dir = $ dir $ _ Files ['upfile'] ['tmp_name'];
Comments
Post a Comment