On Aug 26, 2007, at 9:15 AM, brian wrote:

jekillen wrote:
Hello again;
I have a question about  upload temp dir as defined in php.ini;
I have been working on a project that has registered users, each having
a user space portion of the web site file system. I want them to be
able to upload images and such and have the stuff transfered to their
own user spaces. With one up load temp dir designated, how do I
insure that the uploaded files get to the correct destination?
Or, is it possible to designate more than one up load temp dir in
php.ini. (that would be the best solution)
This situation is not a virtual host environment, but one site that
will be using ssl.

No, the best solution is for your application to grab the path to that particular user's directory and assign a unique name to the uploaded file, then move it from the temp dir:

move_uploaded_file($_FILES['upload_file']['tmp_name'], $upload_path);

where 'upload_file' is the name of your upload form field.

http://www.php.net/manual/en/function.move-uploaded-file.php

I am using Apache on unix based host and am aware that php
assigns a temp name to files that are uploaded, but if different
users are uploading files concurrently, there could be a confusion
as to where each file should be transfered to.

That's unlikely to occur. In fact, i'd be surprised if it were possible that PHP would assign a temp name that already existed.

brian


Thanks thats all I need to know.
Jeff K

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to