You are here: Re: PHP 4.3.11: move_uploaded_file « PHP Programming Language « IT news, forums, messages
Re: PHP 4.3.11: move_uploaded_file

Posted by bill on 11/25/06 15:15

petersprc wrote:
> Try error_reporting(E_ALL) and ini_set('display_errors', true) if
> necessary. May print some warnings. If that doesn't help, maybe check
> the owner of the directory/file, see if you have enough space, or if
> you have a quota on the destination directory...

That helped:
I get the error: Notice: Uninitialized string offset: 0 in
/hsphere/local/home/techserv/iwbreeders.info/members/do-test-upload.php
on line 31

where line 31 is:
echo $_FILES['test-img']['tmp_name'];
which was copied from the move statement:
if (move_uploaded_file($_FILES['test-img']['tmp_name'],
$_SERVER['DOCUMENT_ROOT']. "/members/images/test-file.gif" ))
--rest of if/else statement omitted--

clearly if $_FILES['test-img']['tmp_name'] is uninitialized the
move statement won't work.


I get the same error lower down, which I am discussing in another
thread ($_FILE variable returning null.

I suspect that I am making the same error both places, but can't
figure out what.
>
> bill wrote:
>> I can validate that the file uploaded because is_uploaded_file()
>> returns true.
>> ---------
>> if (is_uploaded_file($_FILES['test-img']['tmp_name'])) {
>> echo "File ". $_FILES['test-img']['name'] ." uploaded
>> successfully.<br />";
>> }
>> ------------------------
>> When I try to move the file using move_uploaded_file it fails.
>> --------------
>> if (move_uploaded_file($_FILES['test-img']['tmp_name'],
>> $_SERVER['DOCUMENT_ROOT']. "/members/images/test-file.gif" )) {
>> echo "File is valid, and was successfully uploaded.<br />";
>> } else {
>> echo "File move failed!<br />";
>> }
>> --------------------------
>>
>> I have checked the existence and permissions on
>> $_SERVER['DOCUMENT_ROOT']. "/members/images/"
>> and it appears ok.
>>
>> What I need is some suggestions on how to debug this.
>> move_uploaded_file just returns a boolean, no idea of why it fails.
>>
>> thanks
>> bill
>

 

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

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