By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,215 Members | 1,920 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,215 IT Pros & Developers. It's quick & easy.

$_FILES[$field_name]['tmp_name'] dirname missing trailing slash

P: n/a
Tom
I've beat my head every way I can think of against this wall. Maybe
someone here just knows the answer.

I'm testing an upload class on my laptop WAMP server. When I run the
test script, everything is fine. When I put together my own form and
test uploading the same file, it fails because the
$_FILES[$field_name]['tmp_name'] value is missing the trailing slash at
the end of the temp dir name, so that the temp name looks like this:

c:/wamp/tmpphp11.tmp

instead of:

c:/wamp/tmp\php11.tmp

as in the packaged demo script.

I know that this value is set in php.ini. But that can't be the
problem as everything works fine in the demo script. As far as I can
discern, this value -- the temp dir name -- is handled internally by
PHP and not affected by the script, so I can't even check the value and
add the slash if it's missing. So my question: does anyone know why
the trailing slash is being dropped in my script?

I've tried every variation I can think of. I even tried to replicate
my error in the demo script by changing some of its form settings. I
can't get the two script to do the same thing with this
$_FILES[$field_name]['tmp_name'] value, even though everything else
should be equal.

All I can figure is that it has something to do with the forms' x/html
settings. The only other significant different between the two scripts
is that mine posts to itself and the demo to a separate page.

Anyway, if you can answer this for me, you'd really make my day! :)

Thanks,
Tom

Dec 5 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Not sure why the two scripts are different... I would try ensuring the
upload_tmp_dir setting has a trailing slash. Maybe magic_quotes_gpc is
mucking things up too... Dunno...

Tom wrote:
I've beat my head every way I can think of against this wall. Maybe
someone here just knows the answer.

I'm testing an upload class on my laptop WAMP server. When I run the
test script, everything is fine. When I put together my own form and
test uploading the same file, it fails because the
$_FILES[$field_name]['tmp_name'] value is missing the trailing slash at
the end of the temp dir name, so that the temp name looks like this:

c:/wamp/tmpphp11.tmp

instead of:

c:/wamp/tmp\php11.tmp

as in the packaged demo script.

I know that this value is set in php.ini. But that can't be the
problem as everything works fine in the demo script. As far as I can
discern, this value -- the temp dir name -- is handled internally by
PHP and not affected by the script, so I can't even check the value and
add the slash if it's missing. So my question: does anyone know why
the trailing slash is being dropped in my script?

I've tried every variation I can think of. I even tried to replicate
my error in the demo script by changing some of its form settings. I
can't get the two script to do the same thing with this
$_FILES[$field_name]['tmp_name'] value, even though everything else
should be equal.

All I can figure is that it has something to do with the forms' x/html
settings. The only other significant different between the two scripts
is that mine posts to itself and the demo to a separate page.

Anyway, if you can answer this for me, you'd really make my day! :)

Thanks,
Tom
Dec 5 '06 #2

P: n/a
Tom
Maybe magic_quotes_gpc is mucking things up too... Dunno...

That must be it. I'm not sure what exactly the problem is yet, but my
script (unlike the demo) does include a (kind-of auto-prepended) step
that attempts to automatically compensate for magic_quotes. Something
in that must be mucking things up. Time to roll up my sleeves.

Thanks!
Tom

On Dec 5, 11:24 am, "petersprc" <peters...@gmail.comwrote:
Not sure why the two scripts are different... I would try ensuring the
upload_tmp_dir setting has a trailing slash. Maybe magic_quotes_gpc is
mucking things up too... Dunno...

Tom wrote:
I've beat my head every way I can think of against this wall. Maybe
someone here just knows the answer.
I'm testing an upload class on my laptop WAMP server. When I run the
test script, everything is fine. When I put together my own form and
test uploading the same file, it fails because the
$_FILES[$field_name]['tmp_name'] value is missing the trailing slash at
the end of the temp dir name, so that the temp name looks like this:
c:/wamp/tmpphp11.tmp
instead of:
c:/wamp/tmp\php11.tmp
as in the packaged demo script.
I know that this value is set in php.ini. But that can't be the
problem as everything works fine in the demo script. As far as I can
discern, this value -- the temp dir name -- is handled internally by
PHP and not affected by the script, so I can't even check the value and
add the slash if it's missing. So my question: does anyone know why
the trailing slash is being dropped in my script?
I've tried every variation I can think of. I even tried to replicate
my error in the demo script by changing some of its form settings. I
can't get the two script to do the same thing with this
$_FILES[$field_name]['tmp_name'] value, even though everything else
should be equal.
All I can figure is that it has something to do with the forms' x/html
settings. The only other significant different between the two scripts
is that mine posts to itself and the demo to a separate page.
Anyway, if you can answer this for me, you'd really make my day! :)
Thanks,
Tom
Dec 5 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.