Re: Re[2]: [PHP4BETA] Upload file error!

[email protected] (Andi Gutmans)
Newsgroups php.version4
Message-ID <[email protected]>
Can you please cut this down to a minimal reproducing script.
Something between 5-10 lines?

Thanks,

Andi


On Sun, 28 May 2000 [email protected] wrote:

> Hello Andi,
> 
> Saturday, May 27, 2000, 8:56:52 PM, you wrote:
> 
> AG> Can you please cut down your script to a very minimal reproducing script 
> AG> and mail it to us?
> AG> Thanks,
> 
> AG> Andi
> 
> AG> At 04:01 AM 5/28/00 -0700, [email protected] wrote:
> >>Hello php4beta,
> >>
> >>   I upload some files in my website.
> >>
> >>   The scripts can be work good in php 4.0.0 Release version, But in
> >>   CVS version It return this messages;
> >>*************************************************************************** 
> >>****
> >>
> >>   Warning: Unable to write to '/home/uploader/temp/1.zip': Bad file 
> >> descriptor
> >>   in /home/httpd/html/Upload.php3 on line 178
> >>
> >>*************************************************************************** 
> >>****
> >>   line 178 is:
> >>
> >>   copy($NewsFile,$Homedir.$NewsFile_name);
> >>
> >>I had already set:
> >>
> >>   $Homedir = "/home/uploader/temp/";
> >>   $NewsFile_name = "1.zip";
> >>
> >>Please help me fix it.
> >>
> >>sorry for my english so poor!
> >>
> >>--
> >>Best regards,
> >>  php                          mailto:[email protected]
> >>
> >>
> >>
> >>--
> >>PHP 4.0 Beta Mailing List <http://www.php.net/version4/>
> >>To unsubscribe, e-mail: [email protected]
> >>For additional commands, e-mail: [email protected]
> >>To contact the list administrators, e-mail: [email protected]
> 
> AG> ---
> AG> Andi Gutmans <[email protected]>
> AG> http://www.zend.com/
> 
> My upload.php3 file:
> ***************************************
> if ($NewsFile && $NewsFile != "none" && $Send == 'Upload'){
>      $Filelist = opendir($Homedir);
>      while($FileName=readdir($Filelist)) {
>             if ($FileName != "." and $FileName != ".."){
>                  unlink($Homedir.$FileName);
>             }
>      }
>      closedir($Filelist);
>      if (strtolower(strrchr($NewsFile_name,".")) == ".zip"){
>           copy($NewsFile,$Homedir.$NewsFile_name);
>           chmod($Homedir.$NewsFile_name,0666);
>           if (filesize($Homedir.$NewsFile_name) == $NewsFile_size){
>               $Messages .= "Upload done!! ZIP file size <font
>               color=red>".number_format($NewsFile_size)."</font>Unzip......<BR>";
>               system("unzip -o ".$Homedir.$NewsFile_name." -d ".$Homedir.">&/tmp/templogs",$OK);
>               if ($OK == 0){
>                    $Messages .= "Unzip done!!<BR><font color=red>Please check file size!!</font>";
>                    unlink($Homedir.$NewsFile_name);
>                    $UploadOK = "OK";
>                    $Filelist = opendir($Homedir);
>                    while($FileName=readdir($Filelist)) {
>                         if ($FileName != "." and $FileName != ".."){
>                             if (strtolower(strrchr($FileName,".")) == ".sql"){
>                                  $Option .= "<option
>                                  value=\"".$FileName."\">".$FileName."--¡µFile size ".number_format(filesize($Homedir.$FileName))."</option>\n";
>                             }else{
>                                  unlink($Homedir.$FileName);
>                             }
>                          }
>                    }
>                    closedir($Filelist);
>               }else{
>                    $Messages .= "Unzip have Error!!<BR>";
>                    unlink($Homedir.$NewsFile_name);
>                    $UploadOK = "NO";
>                    $templogs = file("/tmp/templogs");
>                    for ($i=0;$i<count($templogs);$i++){
>                          $Messages .= nl2br($templogs[$i])."<BR>";
>                    }
>                    unlink("/tmp/templogs");
>               }
>           }
>      }elseif(strtolower(strrchr($NewsFile_name,".")) == ".sql"){
>           copy($NewsFile,$Homedir.$NewsFile_name);
>           chmod($Homedir.$NewsFile_name,0666);
>           if (filesize($Homedir.$NewsFile_name) == $NewsFile_size){
>               $Messages .= "Upload done, please check file size,file size is <font color=red>".number_format($NewsFile_size)."</font>¡£<BR>";
>               $UploadOK = "OK";
>               $Filelist = opendir($Homedir);
>               while($FileName=readdir($Filelist)) {
>                    if ($FileName != "." and $FileName != ".."){
>                         if (strtolower(strrchr($FileName,".")) == ".sql"){
>                              $Option .= "<option
>                              value=\"".$FileName."\">".$FileName."--¡µFile size ".number_format(filesize($Homedir.$FileName))."</option>\n";
>                         }else{
>                              unlink($Homedir.$FileName);
>                         }
>                    }
>               }
>               closedir($Filelist);
>           }
>      }else{
>            $Messages = "File Type only can be .SQL .ZIP";
>            $UploadOK = "NO";
>      }
>  }
> ***************************************
> 
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.