php-windows Digest 7 Nov 2005 03:45:46 -0000 Issue 2815

Topics (messages 26463 through 26464):

Re: file stream reading
        26463 by: trystano.aol.com

Re: PHP 5.0 and MySQL Support
        26464 by: G. Eggold

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [email protected]


----------------------------------------------------------------------
--- Begin Message --- Maybe what your using to send data is not actually sending data. Can you show us what your using to send data, please?

Thanks

Tryst

-----Original Message-----
From: kumar kumar <[EMAIL PROTECTED]>
To: [email protected]
Sent: Sat, 5 Nov 2005 04:41:43 -0800 (PST)
Subject: [PHP-WIN] file stream reading

 hi

The code is written to recive the files sended by the
applet thru http in streams. PHP at server side has to
receive the stream using (php://input)
and as to write at server file  system

this code is not working properly will any body pls
help me in rectifying the error

for all files i am receiving zero bytes

Here is the code
<?php


$save_path  = $_REQUEST['DATADIR'];
$filepath = $_REQUEST['FILEPATH'];
$filename = $_REQUEST['FILENAME'];
$fname = "$filepath$filename";
$tdir =$save_path.$filepath;
     mkMDir($tdir);
   function    mkMDir($dir,$dirmode=0777)
  {
      if (!empty($dir))
      {
          if (!file_exists($dir))
          {
              preg_match_all('/([^\/]*)\/?/i',
$dir,$tmp);
              $default="";
              foreach ($tmp[0] as $key=>$val)
              {
                  $default=$default.$val;
                  if(!file_exists($default))
                      if (!mkdir($default,$dirmode))
                      {
                          return -1;
                      }
              }
          }
          else
              if (!is_dir($dir))
              {
                  return -2;
              }
      }

      return 0;

  }


$getdata = fopen("php://input","r");
$path ="$save_path" .  dirname($fname);
$fname = $save_path . $fname;

if(isset($offset) && $offset > 0 && $offset <=
               filesize($fname))
{
   $fp = fopen($fname,"a+");
   fseek($fp,$offset);
}
else{
   $fp = fopen($fname,"wb");
}

while (!feof($gettdata))
{
   $data = fread($getdata,1024);
   fwrite($fp,$data);
}
   fclose($fp);
   fclose($putdata);
?>

Thanking You
With Regards
Kumar







__________________________________
Yahoo! FareChase: Search multiple travel sites in one click.
http://farechase.yahoo.com

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



--- End Message ---
--- Begin Message ---
Thanks for the advice.  In my case, I'm responding to client demands and
don't have the "luxury" of using Apache.

-gpe

""Supscriptions"" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
Hi,

I was in the same boat as you but now have apache 2 working with mysql on
windows.

Someone posted a link to this site:
http://mpcon.org/apacheguide/apache.php

I unistalled everything and re-installed using the steps shown for apache,
php, phpmyadmin and mysql. Now everything works although like you, I had to
wade through loads of forums and newsgroups for age to find this one link. I
aqlso had no error messages. Would of saved a lot of hassle if it was just
mentioned in the php zip file.

After installing everything I had to reboot xp. Then I got a php error
message. If you get it, goto this page
http://mpcon.org/apacheguide/phpmyadmin.php, look for the 'test' section.
step 3 or 4 mentions copying a file from mysql to windows/system32. re-boot
and everything will work!

--- End Message ---

Reply via email to