469,957 Members | 2,628 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,957 developers. It's quick & easy.

is_uploaded_file() is TRUE but move_uploaded_file() fails - why?

Consider my code:

[PHP]
if ($this->isSuccessful &&
is_file($_FILES['uploaded_resume_path']['tmp_name'])) { //
STEP 6: MOVE RESUME TO DIRECTORY
$uuid = $this->sfug->getUUID();
if (!$uuid) $this->sfug->setUUID();
$uuid = $this->sfug->getUUID();

print_r(is_uploaded_file($_FILES['uploaded_resume_path']['tmp_name']));
error_reporting(E_ALL);
move_uploaded_file($_FILES['uploaded_resume_path']['tmp_name'],
actual_path("$resumeBasePath/$uuid/" .
$_FILES['uploaded_resume_path']['name'])); // realpath() FAILS UNLESS
FILE EXISTS
if (!is_file(actual_path("$resumeBasePath/$uuid/" .
$_FILES['uploaded_resume_path']['name']))) {
list($moveKommand, $moveRedirect) =
@array_values($this->getKommandOSArray('move'));
$msg = exec("$moveKommand \"" .
$_FILES['uploaded_resume_path']['tmp_name'] . '" "' .
actual_path("$resumeBasePath/$uuid/" .
$_FILES['uploaded_resume_path']['name']) . "\" $moveRedirect");
if ($msg || !is_file(actual_path("$resumeBasePath/$uuid/" .
$_FILES['uploaded_resume_path']['name']))) {
$this->isSuccessful = false;
$this->setErrorArray(array('uploaded_resume_path' => 'Was unable
to store uploaded resume: ' . nl2br($msg)));
}
}
}
error_reporting(E_ALL && ~E_NOTICE);
[/PHP]

Upon testing I found that is_uploaded_file() is set to TRUE, but
move_uploaded_file() fails, no errors, no warnings, nothing, it just
completely fails to move the file, even though it is proven to not only
exist but is findable.

What could cause something like that to occur?

Thanx
Phil

Mar 27 '06 #1
1 4023
comp.lang.php wrote:
Consider my code:

[PHP]
if ($this->isSuccessful &&
is_file($_FILES['uploaded_resume_path']['tmp_name'])) { //
STEP 6: MOVE RESUME TO DIRECTORY
$uuid = $this->sfug->getUUID();
if (!$uuid) $this->sfug->setUUID();
$uuid = $this->sfug->getUUID();

print_r(is_uploaded_file($_FILES['uploaded_resume_path']['tmp_name']));
error_reporting(E_ALL);
move_uploaded_file($_FILES['uploaded_resume_path']['tmp_name'],
actual_path("$resumeBasePath/$uuid/" .
$_FILES['uploaded_resume_path']['name'])); // realpath() FAILS UNLESS
FILE EXISTS
if (!is_file(actual_path("$resumeBasePath/$uuid/" .
$_FILES['uploaded_resume_path']['name']))) {
list($moveKommand, $moveRedirect) =
@array_values($this->getKommandOSArray('move'));
$msg = exec("$moveKommand \"" .
$_FILES['uploaded_resume_path']['tmp_name'] . '" "' .
actual_path("$resumeBasePath/$uuid/" .
$_FILES['uploaded_resume_path']['name']) . "\" $moveRedirect");
if ($msg || !is_file(actual_path("$resumeBasePath/$uuid/" .
$_FILES['uploaded_resume_path']['name']))) {
$this->isSuccessful = false;
$this->setErrorArray(array('uploaded_resume_path' => 'Was unable
to store uploaded resume: ' . nl2br($msg)));
}
}
}
error_reporting(E_ALL && ~E_NOTICE);
[/PHP]

Upon testing I found that is_uploaded_file() is set to TRUE, but
move_uploaded_file() fails, no errors, no warnings, nothing, it just
completely fails to move the file, even though it is proven to not only
exist but is findable.

What could cause something like that to occur?

Thanx
Phil


Are you running in safe-mode or using open_basedir? If restrictions
imposed by either of these is preventing the move, move_uploaded_file()
would fails without emitting an error.

Mar 28 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by neo002244 | last post: by
4 posts views Thread by Ralph Freshour | last post: by
2 posts views Thread by Ralph Freshour | last post: by
1 post views Thread by Felix Natter | last post: by
exoskeleton
6 posts views Thread by exoskeleton | last post: by
4 posts views Thread by Batmanuel | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.