php-windows Digest 1 Oct 2001 13:02:29 -0000 Issue 783

Topics (messages 9628 through 9632):

Re: Using COM
        9628 by: David Broker

Re: mysql_fetch_array() doesn't work
        9629 by: Justin Blake

php vs asp
        9630 by: raj

copying files...?
        9631 by: Andrew.Martin
        9632 by: Asendorf, John

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 ---
In article <[EMAIL PROTECTED]>, 
[EMAIL PROTECTED] (Crawley) wrote:
>
>"David Broker" <[EMAIL PROTECTED]> wrote in message
>[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
>> Rich,
>> Microsoft claims (in the IIS help) that this is an object which you can
>access
>> with any language which supports COM.
>>
>> In the VBscript found on any Win2K server it is called like this:
>> varname = GetObject("IIS://localhost/w3scv")
>>
>> So I'm assuming that IIS://localhost/w3scv is an object.
>>
>> My problem was that I could not access that object, as that format (the
>> "IIS://")is not supported in the non-dev releases.
>>
>> I will (probably) be running it on a local machine so I shouldn't have a
>> problem there.
>>
>> Regards,
>> David
>
>Right mate, Ive had a quick search on Google and found this....
>
>Under Foxpro - you access it like
>loIIS=CREATE("wwIISAdmin.IIS4Config")
>IF loIIS.ConnectPath("IIS://LOCALHOST/W3SVC/1/ROOT")
>   ? loIIS.GetValue("AuthBasicIsolated")
>   ? loIIS.GetValue("DefaultDoc")
>
>   ? loIIS.m_oIISObj.Stop()
>   * ? loIIS.m_oIISObj.Start()
>ELSE
>wait window "Unable to retrieve path..."
>ENDIF
>
>So I would suspect that the interface is "wwIISAdmin.IIS4Config" or
>something like that.  Thus if Im correct you would need something like
>
><?php
>
>$IIS_Admin = COM( "wwIISADmin.IIS4Config" );
>if( $IIS_Admin->ConnectPath( "IIS://Localhost/W3SVC/1/ROOT" ) )
>{
>.....
>
>you get the idea.
>
>Hope that helps.
>
>Rich

Rich,
$iis = COM(IIS://localhost/w3svc/1");
echo $iis->status;
worked fine and printed out "Running".

Ofcourse it will only work when run from the commandline when logged on a 
Administrator, as the webserver doesn't have permission to read/write the IIS 
meta-database, which kindof kills my idea for a quick-and-easy setup of a 
large number virtual hosts where the setup is all the same.

However $iis->stop does not work. It seems even from the command line I cannot 
write to the meta-database.

Regards,
David
--- End Message ---
--- Begin Message ---
> It only works when  the $arr['user_id'] is out of the quotes.
> echo "<tr><td><a href=\"profile.php?id=".$arr['user_id']."\"
> target='_top'>";
> then IE showed no error any longer

Thank you! I was having the exact same problem.

Justin -- http://blaix.org

--- End Message ---
--- Begin Message ---
hi there

I've been told that php outperforms asp. is this true if yes why ?

kind regards


--- End Message ---
--- Begin Message ---
I want to copy a file from a users PC (via a form) to a specific folder on
the webserver and store the file name in the Database.
I have tried to use the copy($string, $path) function but I keep getting
errors. 

Does anyone know a simplat solution for this? Do I have to copy the contents
of the file to a temp file on the server first? If so how?
Or is there another function to do what I require?

thanks,

Andrew
--- End Message ---
--- Begin Message ---
Here's what I use.  It is for multiple files.  It has some bugs (for
instance, if it errors out it still reports success) so if you fix them, I'd
appreciate you sending me the fix.  I rename the files as they come in with
this script in case you're confused by the rename....

Directory names have been changed to protect the innocent.

------------------


if ( isset ( $files ) ) {

//send an email to the webmaster if someone hits this area
MAIL( "[EMAIL PROTECTED]", "CC Resolution Uploads Attempted", "From:
$email\nX-Mailer: PHP/" . phpversion());

        for ( $i=0  ; file_exists ( $files[$i] ) ; $i++ ) {
                echo "Trying to upload " . $files_name[$i] . "...<br />\n";

     // if the file is too big, don't accept it (200K)
     if ( $files_size[$i] > 200000 ) {
           echo "The file, $result_name ($file_size bytes), is too big.
Files that large are too big for this particular use.  Possible attack
dropped.  Please contact $webmaster if you receive this message.<br />\n";
                }

            // if $result_name isn't empty, try to copy the file
            elseif ( eregi ( "([0-9]{1,3})\-([0-9]{1,3})([A-Za-z]?)([a-z0-9
,.]*).(doc|rtf)" , $files_name[$i] , $newres_name ) ) {

                        echo "ERROR CHECK: Good Name!<br />\n";
                        $newfilename = $newres_name[1] . '-' .
$newres_name[2] . $newres_name[3] . "." . $newres_name[5];

                         if ( !file_exists ( $newfilename ) ) {

                            // copy the file to a directory or
                            // print an error message

                            // NOTE! if you're on a Windows machine,
                            // use Windows pathnames, like so:
                            // copy("$img1",
"C:\\some\\directory\\path\\$img1_name");

                            copy("$files[$i]",
"D:\\foo\\bar\\fbarred\\$files_name[$i]")
                    or die("Couldn't copy the file!");

                                   //rename the file
                                  rename("D:/foo/bar/fbarred/" .
$files_name[$i], "D:/foo/bar/fbarred/" . $newfilename);

    ?>
          <H2>SUCCESS!</H2>
          <P><B>You sent:</B> <? echo "$files_name[$i]"; ?>, a <? echo
"$files_size[$i]"; ?>
          byte file with a mime type of <? echo "$files_type[$i]"; ?>.<br />
        It has been renamed <B><? echo "$newfilename";
?></B>.</p><P>&nbsp;</P><P>&nbsp;</P>

  <?PHP
                                  }
                                else {
                                        //file as renamed already exists
                                        //GOTTA DO SOMETHING HERE TO ALLOW A
REPLACE
                                        echo "<H3>That file already
exists!</H3><br /><br />\n";
                                }
                }

                else {
                         //file didn't fit eregi check
                         echo "I don't understand that file name or no input
file specified.";
                }
        }
            
}

/* ***********************************
*** MAIN ELSE - form to enter file***
************************************ */
else { ?>
        <form enctype="multipart/form-data" method="post" action="<?echo
$PHP_SELF?>">

        <P><strong>File to Upload:</strong><P>
        <?PHP
                        for ($i=1 ; $i<=20 ; $i++ ) { ?>
                
        <P>File: <input type="file" name="files[]" size="60"></p>
                <?PHP } ?>
                
        <P>&nbsp;</P>

        <P><input type="submit" name="submit" value="Upload Results"></p>
        <?PHP
}





---------------------
John Asendorf - [EMAIL PROTECTED]
Web Applications Developer
http://www.lcounty.com - NEW FEATURES ADDED DAILY!
Licking County, Ohio, USA
740-349-3631
Nullum magnum ingenium sine mixtura dementiae fuit


> -----Original Message-----
> From: Andrew.Martin [mailto:[EMAIL PROTECTED]]
> Sent: Monday, October 01, 2001 7:07 AM
> To: [EMAIL PROTECTED]
> Subject: [PHP-WIN] copying files...?
> 
> 
> I want to copy a file from a users PC (via a form) to a 
> specific folder on
> the webserver and store the file name in the Database.
> I have tried to use the copy($string, $path) function but I 
> keep getting
> errors. 
> 
> Does anyone know a simplat solution for this? Do I have to 
> copy the contents
> of the file to a temp file on the server first? If so how?
> Or is there another function to do what I require?
> 
> thanks,
> 
> Andrew
> 
--- End Message ---

Reply via email to