Upload dir
am 11.12.2009 06:29:27 von kranthi
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
Re: Upload dir
am 11.12.2009 07:59:36 von Gaurav Kumar
--00504502ad207650ed047a6e7739
Content-Type: text/plain; charset=ISO-8859-1
OK you used ini_get try using ini_set and set the temporary directory on
your server of your choice at run time in your script (top of the script or
any config file if you have one).
REMEMBER that you have access to that directory, should have full
permissions and also check the absolute server path is correct while you set
the directory.
More information on how to use ini_set to set the directory path- try
googling...
Gaurav Kumar
blog.oswebstudio.com
On Fri, Dec 11, 2009 at 10:59 AM, kranthi wrote:
> 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
>
>
--00504502ad207650ed047a6e7739--
Re: Upload dir
am 11.12.2009 08:36:33 von kranthi
i doubt i can use ini_set in this scenario
http://us3.php.net/manual/en/ini.core.php#ini.upload-tmp-dir
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Upload dir
am 11.12.2009 09:07:53 von kranthi
my mistake.... didn't use move_uploaded_file to see if the uploading
is working or not in the first case....
but i could not understand why
1. ini_get() is giving correct value while
$_FILES['file']['tmp_name'] is ignoring that.
2. move_uploaded_file($_FILES['file']['tmp_name'], 'file.php'); is
working fine but file_exists($_FILES['file']['tmp_name']) is returning
false
3. php_admin_value upload_tmp_dir "/var/www/html"
in httpd.conf seems to work ($_FILES['file']['tmp_name'] is not ignoring that);
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Upload dir
am 11.12.2009 16:44:17 von Richard Quadling
2009/12/11 kranthi :
> How can i change the temporary upload directory?
> var_dump(ini_get('upload_tmp_dir')); Â Â Â gives me (and th=
at is set in php.ini)
> string '/var/www/cgi-bin' (length=3D16)
>
> but
> var_dump($_FILES) Â Â Â Â Â Â Â Â =
          =C2=
=A0 Â Â Â Â Â Â Â gives me
> 'tmp_name' =3D> string '/tmp/phpbSZ6WP' (length=3D14)
>
> 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 i=
n 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-upl oads
[2] http://docs.php.net/manual/en/configuration.changes.modes.ph p
--=20
-----
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=3DZEND002498&r=3D213474=
731
ZOPA : http://uk.zopa.com/member/RQuadling
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Upload dir
am 11.12.2009 16:44:48 von Ashley Sheridan
--=-iQn0ONG4taQrEdG9DRdC
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
On Fri, 2009-12-11 at 15:44 +0000, Richard Quadling wrote:
> 2009/12/11 kranthi :
> > 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-upl oads
> [2] http://docs.php.net/manual/en/configuration.changes.modes.ph p
>
> --
> -----
> 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
--=-iQn0ONG4taQrEdG9DRdC--
Re: Upload dir
am 12.12.2009 16:10:03 von Richard Quadling
2009/12/11 Ashley Sheridan
>
> On Fri, 2009-12-11 at 15:44 +0000, Richard Quadling wrote:
>
> 2009/12/11 kranthi :
> > 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=3D16)
> >
> > but
> > var_dump($_FILES) Â Â Â Â Â Â Â =C2=
=A0 Â Â Â Â Â Â Â Â Â Â =
        gives me
> > 'tmp_name' =3D> string '/tmp/phpbSZ6WP' (length=3D14)
> >
> > var_dump(file_exists($_FILES['file']['tmp_name'])); Â gives me =C2=
=A0(/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-upl oads
> [2] http://docs.php.net/manual/en/configuration.changes.modes.ph p
>
> --
> -----
> 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=3DZEND002498&r=3D2134=
74731
> ZOPA : http://uk.zopa.com/member/RQuadling
>
>
> The only reason I can see for wanting to do this would be where several s=
ites 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=3DZEND002498&r=3D213474=
731
ZOPA : http://uk.zopa.com/member/RQuadling
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php