You are here: Re: is_uploaded_file() is TRUE but move_uploaded_file() fails - why? « PHP Programming Language « IT news, forums, messages
Re: is_uploaded_file() is TRUE but move_uploaded_file() fails - why?

Posted by Chung Leong on 11/18/88 11:43

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.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация