Re[2]: [PHP] How to make Browse Folder Dialog

2007-01-24 Thread karo bugumyan

http://cwashington.netreach.net/depo/default.asp?topic=repositorymove=nextScriptType=vbscriptSubType=Misc

Script:

'
' FolderSelectDialog.vbs
' Alan Kaplan alan at akaplan dot com 12-15-2005
' after getting tired of reading it will not work...
' Based in part on FileSelectDialog.vbs by Gunter Born
' Kaplan added handling of special folders
' Tested okay with XP and 2000
' Uses the shell browseforfolder method to select a folder
'
Option Explicit

' Flags for the options parameter
Const BIF_returnonlyfsdirs = H0001'Don't want no steenkin' filenames
Const BIF_ShowAllObjects  = H0008'ReturnFSAncestors. This will give 
you typical root view
'XP has My Computer, My Network Places 
not seen on 2000
Const BIF_editbox = H0010'Show active selection, allows manual input

Dim wshShell
'Wscript object
Set wshShell = WScript.CreateObject(WScript.Shell)

'=== Example ===
Dim strFolder

StrFolder = BrowseForFolder(Choose a folder, then click OK:, _
BIF_returnonlyfsdirs + BIF_editbox + BIF_ShowAllObjects,)

If Len(strFolder)0 Then
MsgBox strFolder,vbOKOnly, Selected Folder
End If 

'= End Example ===

Function BrowseForFolder(title, flag, dir)
' title = Text shown in the dialog box
' flag = values controlling BrowseForFolder behavior
' dir = Initial directory (can be ). 
'dir most useful when not using BIF_ShowAllObjects 
On Error Resume Next
Dim oShell, oItem, strSelection

' Create Shell object.
Set oShell = WScript.CreateObject(Shell.Application)

' Invoke Browse For Folder dialog box.
Set oItem = oShell.BrowseForFolder(H0, title, flag, dir)
strSelection = oItem.Title 
If Err  0 Then 'cancelled
Set oShell = Nothing
Set oItem = Nothing
Exit Function
End If

' If colon found then get drive letter from the title. No array
If InStr(strSelection, :) Then 
BrowseForFolder = mid(strSelection,InStr(strSelection, :)-1, 2)
Else
'Handle all other special cases where path not returned 
Select Case strSelection
Case Desktop
BrowseForFolder = wshShell.SpecialFolders(Desktop)
Case My Documents
BrowseForFolder = wshShell.SpecialFolders(MyDocuments)
Case My Computer
MsgBox Invalid selection,vbCritical + vbOKOnly,Error
WScript.Quit
Case My Network Places
MsgBox Invalid selection,vbCritical + vbOKOnly,Error
WScript.Quit
Case Else
 ' Finally try to retrieve the full path a la Born
 BrowseForFolder = oItem.ParentFolder.ParseName(oItem.Title).Path
End Select
End If

'Cleanup 
Set oShell = Nothing
Set oItem = Nothing

'make sure they all end in \
If Right(browseForFolder,1) \ Then
browseforfolder = browseforfolder  \
End If

'Alternate make sure they all end without \
' If Right(browseForFolder,1) = \ Then
' browseforfolder = left(BrowseForFolder,Len(BrowseForFolder)-1)
' End If

On Error GoTo 0
End Function

Wednesday, January 24, 2007, 9:51:24 AM, you wrote:


 Hello,
 Just a minute. I know the php script will run on server. Suppose i m working
 on server machine and i need to make a project for myself. The machine is
 only one and same. Also there are a lot of file and directory methods
 available in PHP, Whats that? Actually i want to show the files of selected
 folder on screen.
 Thanks...


 Travis Doherty-2 wrote:
 
 Borge Holen wrote:
 
On Wednesday 24 January 2007 07:32, Travis Doherty wrote:
  

Aslam Bari wrote:


Dear All,
I m new in this Forum. I m making a project in which i need to show user
 a
Browse Folder Dialog Box, In which he can select a folder and after this
 i
will do some manipulation on that folder's content. So the problem is
 that
i could not found any sample on Web , how to show Folder Dialog in any
way (HTML, JavaScript, PHP etc). Plz has anybody some idea how to do
 some
work around this.

Thanks...
  

PHP won't let you edit files on your users' computer.  Ever.

Maybe it would be worth your time to look into a different language to
do whatever it is you want to do, something like Visual Basic might suit
you well (last time I used it there was a control that would popup the
standard windows 'Select Folder' dialog.)

Travis Doherty



Ouch, this is close to swearing in the church...

  

 :p  I suppose it is.  Use the right tool for the job right?  PHP on a
 server won't ever let the OP manipulate the content of a folder on his
 users computer.
 
 T
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 

 -- 
 View this message in context:
 http://www.nabble.com/How-to-make-Browse-Folder-Dialog-tf3079100.html#a8555797
 Sent from the PHP - General mailing list archive at 

Re: [PHP] How to make Browse Folder Dialog

2007-01-24 Thread Richard Lynch
On Wed, January 24, 2007 1:11 am, Travis Doherty wrote:
 Aslam Bari wrote:

Hello,
Just a minute. I know the php script will run on server. Suppose i m
 working
on server machine and i need to make a project for myself. The
 machine is
only one and same. Also there are a lot of file and directory methods
available in PHP, Whats that? Actually i want to show the files of
 selected
folder on screen.

Perhaps PHP GTK has a dialog like you want...
:-)


-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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



[PHP] How to make Browse Folder Dialog

2007-01-23 Thread Aslam Bari

Dear All,
I m new in this Forum. I m making a project in which i need to show user a
Browse Folder Dialog Box, In which he can select a folder and after this i
will do some manipulation on that folder's content. So the problem is that i
could not found any sample on Web , how to show Folder Dialog in any way
(HTML, JavaScript, PHP etc). Plz has anybody some idea how to do some work
around this.

Thanks...
-- 
View this message in context: 
http://www.nabble.com/How-to-make-Browse-Folder-Dialog-tf3079100.html#a8554729
Sent from the PHP - General mailing list archive at Nabble.com.

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



Re: [PHP] How to make Browse Folder Dialog

2007-01-23 Thread Travis Doherty
Aslam Bari wrote:

Dear All,
I m new in this Forum. I m making a project in which i need to show user a
Browse Folder Dialog Box, In which he can select a folder and after this i
will do some manipulation on that folder's content. So the problem is that i
could not found any sample on Web , how to show Folder Dialog in any way
(HTML, JavaScript, PHP etc). Plz has anybody some idea how to do some work
around this.

Thanks...
  

PHP won't let you edit files on your users' computer.  Ever.

Maybe it would be worth your time to look into a different language to
do whatever it is you want to do, something like Visual Basic might suit
you well (last time I used it there was a control that would popup the
standard windows 'Select Folder' dialog.)

Travis Doherty

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



Re: [PHP] How to make Browse Folder Dialog

2007-01-23 Thread Børge Holen
On Wednesday 24 January 2007 07:32, Travis Doherty wrote:
 Aslam Bari wrote:
 Dear All,
 I m new in this Forum. I m making a project in which i need to show user a
 Browse Folder Dialog Box, In which he can select a folder and after this i
 will do some manipulation on that folder's content. So the problem is that
  i could not found any sample on Web , how to show Folder Dialog in any
  way (HTML, JavaScript, PHP etc). Plz has anybody some idea how to do some
  work around this.
 
 Thanks...

 PHP won't let you edit files on your users' computer.  Ever.

 Maybe it would be worth your time to look into a different language to
 do whatever it is you want to do, something like Visual Basic might suit
 you well (last time I used it there was a control that would popup the
 standard windows 'Select Folder' dialog.)

 Travis Doherty

Ouch, this is close to swearing in the church...

-- 
---
Børge
Kennel Arivene 
http://www.arivene.net
---

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



Re: [PHP] How to make Browse Folder Dialog

2007-01-23 Thread Travis Doherty
Børge Holen wrote:

On Wednesday 24 January 2007 07:32, Travis Doherty wrote:
  

Aslam Bari wrote:


Dear All,
I m new in this Forum. I m making a project in which i need to show user a
Browse Folder Dialog Box, In which he can select a folder and after this i
will do some manipulation on that folder's content. So the problem is that
i could not found any sample on Web , how to show Folder Dialog in any
way (HTML, JavaScript, PHP etc). Plz has anybody some idea how to do some
work around this.

Thanks...
  

PHP won't let you edit files on your users' computer.  Ever.

Maybe it would be worth your time to look into a different language to
do whatever it is you want to do, something like Visual Basic might suit
you well (last time I used it there was a control that would popup the
standard windows 'Select Folder' dialog.)

Travis Doherty



Ouch, this is close to swearing in the church...

  

:p  I suppose it is.  Use the right tool for the job right?  PHP on a
server won't ever let the OP manipulate the content of a folder on his
users computer.

T

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



Re: [PHP] How to make Browse Folder Dialog

2007-01-23 Thread Aslam Bari

Hello,
Just a minute. I know the php script will run on server. Suppose i m working
on server machine and i need to make a project for myself. The machine is
only one and same. Also there are a lot of file and directory methods
available in PHP, Whats that? Actually i want to show the files of selected
folder on screen.
Thanks...


Travis Doherty-2 wrote:
 
 Børge Holen wrote:
 
On Wednesday 24 January 2007 07:32, Travis Doherty wrote:
  

Aslam Bari wrote:


Dear All,
I m new in this Forum. I m making a project in which i need to show user
a
Browse Folder Dialog Box, In which he can select a folder and after this
i
will do some manipulation on that folder's content. So the problem is
that
i could not found any sample on Web , how to show Folder Dialog in any
way (HTML, JavaScript, PHP etc). Plz has anybody some idea how to do
some
work around this.

Thanks...
  

PHP won't let you edit files on your users' computer.  Ever.

Maybe it would be worth your time to look into a different language to
do whatever it is you want to do, something like Visual Basic might suit
you well (last time I used it there was a control that would popup the
standard windows 'Select Folder' dialog.)

Travis Doherty



Ouch, this is close to swearing in the church...

  

 :p  I suppose it is.  Use the right tool for the job right?  PHP on a
 server won't ever let the OP manipulate the content of a folder on his
 users computer.
 
 T
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 

-- 
View this message in context: 
http://www.nabble.com/How-to-make-Browse-Folder-Dialog-tf3079100.html#a8555797
Sent from the PHP - General mailing list archive at Nabble.com.

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



Re: [PHP] How to make Browse Folder Dialog

2007-01-23 Thread Travis Doherty
Aslam Bari wrote:

Hello,
Just a minute. I know the php script will run on server. Suppose i m working
on server machine and i need to make a project for myself. The machine is
only one and same. Also there are a lot of file and directory methods
available in PHP, Whats that? Actually i want to show the files of selected
folder on screen.
Thanks...
  

Yes, PHP has file handling functions for use on the server it is running
on.  As long as we're clear that it can't touch the filesystem of the
user of the application :D

If you just wanted to make a list of folders and let them select one you
could build the list using an HTML SELECT box.  Once they have selected
an item and click on submit, you would use similar code that you used to
populate your directory list to show a list of all files in that directory.

The code at Example 2 on the php.net readdir documentation is probably
one good place to start: http://www.php.net/readdir

A hint from another thread today to save yourself trouble: Always use
full paths when working with files.

T

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