Re: Upload dir
| From: | Richard Quadling | Date: | Sat, 12 Dec 2009 15:10:03 +0000 |
| Subject: | Re: Upload dir | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-300439@lists.php.net to get a copy of this message | ||
2009/12/11 Ashley Sheridan <ash@ashleysheridan.co.uk>
>
> On Fri, 2009-12-11 at 15:44 +0000, Richard Quadling wrote:
>
> 2009/12/11 kranthi <kranthi117@gmail.com>:
> > How can i change the temporary upload directory?
> > var_dump(ini_get('upload_tmp_dir')); gives me (and that is set in
> > php.ini)
> > string '/var/www/cgi-bin' (length=16)
> >
> > but
> > var_dump($_FILES)
> > gives me
> > 'tmp_name' => string '/tmp/phpbSZ6WP' (length=14)
> >
> > var_dump(file_exists($_FILES['file']['tmp_name'])); gives me (/tmp
> > has permissions drwxrwxrwt and i never used file_move_upload or any
> > similar functions)
> > boolean false
> >
> > am I missing something here?
> > Kranthi.
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
> Just assuming you could alter the upload_tmp_dir setting in your code
> (you can't) ...
>
> PHP puts the uploaded files into the upload_tmp_dir BEFORE your script
> runs, so changing it in your script essentially hides the uploaded
> files.
>
> PHP drops the files into directory A.
> PHP then runs your code.
> Your code changes the directory to B.
> Your code cannot see the files PHP put into A as your code is now looking in B.
>
> But, as I said earlier, you can't use your code to change
> upload_tmp_dir. It can only be done at the system level (php.ini or
> httpd.conf). See [1] and [2].
>
> Regards,
>
> Richard Quadling.
>
> [1]
> http://docs.php.net/manual/en/ini.core.php#ini.sect.file-uploads
> [2]
> http://docs.php.net/manual/en/configuration.changes.modes.php
>
> --
> -----
> Richard Quadling
> "Standing on the shoulders of some very clever giants!"
> EE : http://www.experts-exchange.com/M_248814.html
> Zend Certified Engineer :
> http://zend.com/zce.php?c=ZEND002498&r=213474731
> ZOPA : http://uk.zopa.com/member/RQuadling
>
>
> The only reason I can see for wanting to do this would be where several sites exist on the same
> server and you might want each site to have its own temporary upload directory. It won't have
> any bearing on how you handle the uploads unless it becomes full.
>
> Thanks,
> Ash
> http://www.ashleysheridan.co.uk
>
>
Another way to handle this is via php.ini sections [1]
Regards,
Richard.
[1] http://docs.php.net/manual/en/ini.sections.php
--
-----
Richard Quadling
"Standing on the shoulders of some very clever giants!"
EE : http://www.experts-exchange.com/M_248814.html
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
ZOPA : http://uk.zopa.com/member/RQuadling