Page 1 of 1

tmp directory name very basic question

Posted: Thu Jun 05, 2003 6:48 am
by mesz
I have a question about the tmp-name location when uploading images using PHP.
My Unix server is using Apache.
My web-host is as useful as burnt toast.
I am not an experienced developer.
The only thing preventing me from being able to upload images is knowing what I am supposed to specify as my temporary directory location.
No matter what combination of words I try I always get a parse error advsing thatt no such file or directory exists.
Is it \www\docs\mysitename\directory..
or
\directory\filename
or
filename\
or
vars\doc\www\mysitename\directory\
or
..............................?
I have read every tutorial on earth about image uplaods, and no matter how well written and basic they all say " // location of your temporary directory ..." and I just do not know.
For the love of God someone please help.

Posted: Thu Jun 05, 2003 12:21 pm
by Galahad
You're running on a *nix system, right? After just a quick glance, I'd recommend that you try using "/" in your path instead if "\". Hopefully you can have more success with that. I'll see if I can come up with something as to how to find the temp directory.

Posted: Thu Jun 05, 2003 12:38 pm
by Galahad
Ok, if you have any shell access to the server, you can figure out where the temp file is by looking at the file "/etc/php.ini". Look for the line "upload_tmp_dir = /some/directory". I'm not sure you even need that though. What are you using this directory for? It's been a little while since I worked with uploads, but browsing this php manual page (the example just before the user contributed notes is especially helpful) leads me to believe that the php (if you have php version 4.0.3 or later) will take care of the temporary upload directory automatically. I may be wrong, though.

Try doing a "print_r($_FILES)" (or $HTTP_POST_FILES if you have php version 4.1.0 or earlier) and see what gets printed. Try the example from the php manual (the example form that allows the user to choose the file to upload is earlier on that same page) and see what happens. You will probably want to change the $uploaddir to be the directoy you want the file to end up in, though. Let us know how it goes.

Posted: Fri Jun 06, 2003 5:44 am
by mesz
Thank you for your reply.
Let me tell you a story.......
A couple of weeks ago I was trying to create a news service and was having problems with directories.
I laughed I cried I dispaired but I could not figure it out....then I tried just naming the directory - no backslashes, directory structure, or UNIX syntax and IT WORKED.
I then tried the same again for this image upload problem but nothing would work...I literaly have been doing this for two weeks solid. Yesterady I realised that the whole time I had a problem with my quotes. I had just forgotten to quadruple check my syntax.
To any other newbies - Check your syntax several hundred times, have a break and then read it again.