browse for files?

89 views
Skip to first unread message

Waitman Gobble

unread,
Aug 28, 2014, 3:08:47 AM8/28/14
to php...@googlegroups.com
I need a way to open a file dialog to select files. So user can select 'c:\filea.txt' and 'c:\fileb.txt', etc. then run the script which operates on these files.

Perhaps this is simply a ('fake'?) upload form? 

Getting ready to get into it, I scanned for 'browse' and 'upload' in the documentation and didn't snag any results so I thought i'd ask here in case someone has experience using ZZEE PhpExe in a similar application.

I presume it's possible to access any file from ZZEE PhpExe, which the user has permission to access.

--
Waitman Gobble
San Jose California USA
510-830-7975

ZZEE Groups

unread,
Aug 28, 2014, 4:06:29 AM8/28/14
to php...@googlegroups.com
Hi Waitman,

As far as I understand, you need to use a Javascript dialog
external.FileOpenSaveDialog:

http://zzee.com/phpexe/help.html#zzee_link_15_1215035079
> --
> --
> You received this message because you are subscribed to the Google
> Groups "ZZEE PHPExe" group.
> To post to this group, send email to php...@googlegroups.com
> To unsubscribe from this group, send email to
> phpexe+un...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/phpexe?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "ZZEE PHPExe" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to phpexe+un...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



--
Regards,
Paul.

Follow ZZEE on Facebook:
http://www.facebook.com/zzee.software

Feel free to become friends with Paul Slavic:
http://facebook.com/Paul.Slavic

Waitman Gobble

unread,
Aug 28, 2014, 4:13:48 AM8/28/14
to php...@googlegroups.com

Hi,

Thanks.. thats quite handy.

Waitman

Martin Verlaan

unread,
Feb 8, 2015, 2:55:05 PM2/8/15
to php...@googlegroups.com
I tried this function (from the documentation) but I get this error: OFN_ALLOWMULTISELECT not defined. Is there a way to solve this? I really want multiple select!

Op donderdag 28 augustus 2014 09:08:47 UTC+2 schreef Waitman Gobble:

Martin Verlaan

unread,
Feb 8, 2015, 3:00:04 PM2/8/15
to php...@googlegroups.com
I forgot to mention the function that I use:

<script type="text/javascript">
function openMultiFiles()
{
   
var dialog = external.FileOpenSaveDialog();
    dialog
.flags = OFN_ALLOWMULTISELECT | OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST;
    dialog
.extensionFilter = 'XLS files|*.xls|All files|*.*||';
    dialog
.defaultExtension = 'xls';
    dialog
.title = "Open multiple files";
    dialog
.initialDir = "C:\\Documents and Settings";
   
if (dialog.open()) {
       
// Initialize array "files" to receive those file names
       
var files = [];
       
if ( dialog.splitMultiSelect(files) ) {
           
// User has selected multiple files:
            alert
("Multiple files are selected:\n" + files.join("\n") + "\nIn this directory:\n" + dialog.returnFullPath);
       
} else {
           
// User has selected just one file:
            alert
("A single file is selected:\n" + dialog.returnFullPath);
       
}
   
} else {
       
// User has cancelled the dialog
   
}
}
</script>

ZZEE Groups

unread,
Feb 9, 2015, 2:29:45 AM2/9/15
to php...@googlegroups.com
Hi Martin,

You first need to define this constant. You can do it by including
this code (see section "8.5.2. Constants for file and folder dialogs
and ShellExecute" of the help file):

// Windows Comm dialog flags for file open/save.
// More information is available here:
// http://msdn.microsoft.com/en-us/library/ms646839.aspx
var OFN_READONLY = 0x00000001;
var OFN_OVERWRITEPROMPT = 0x00000002;
var OFN_HIDEREADONLY = 0x00000004;
var OFN_NOCHANGEDIR = 0x00000008;
var OFN_SHOWHELP = 0x00000010;
var OFN_ENABLEHOOK = 0x00000020;
var OFN_ENABLETEMPLATE = 0x00000040;
var OFN_ENABLETEMPLATEHANDLE = 0x00000080;
var OFN_NOVALIDATE = 0x00000100;
var OFN_ALLOWMULTISELECT = 0x00000200;
var OFN_EXTENSIONDIFFERENT = 0x00000400;
var OFN_PATHMUSTEXIST = 0x00000800;
var OFN_FILEMUSTEXIST = 0x00001000;
var OFN_CREATEPROMPT = 0x00002000;
var OFN_SHAREAWARE = 0x00004000;
var OFN_NOREADONLYRETURN = 0x00008000;
var OFN_NOTESTFILECREATE = 0x00010000;
var OFN_NONETWORKBUTTON = 0x00020000;
var OFN_NOLONGNAMES = 0x00040000;
var OFN_EXPLORER = 0x00080000;
var OFN_NODEREFERENCELINKS = 0x00100000;
var OFN_LONGNAMES = 0x00200000;
var OFN_ENABLEINCLUDENOTIFY = 0x00400000;
var OFN_ENABLESIZING = 0x00800000;
var OFN_DONTADDTORECENT = 0x02000000;
var OFN_FORCESHOWHIDDEN = 0x10000000;


// Windows shell SHBrowseForFolder flags
// More information is available here:
// http://msdn.microsoft.com/en-us/library/bb773205.aspx
var BIF_RETURNONLYFSDIRS = 0x0001;
var BIF_DONTGOBELOWDOMAIN = 0x0002;
var BIF_STATUSTEXT = 0x0004;
var BIF_RETURNFSANCESTORS = 0x0008;
var BIF_EDITBOX = 0x0010;
var BIF_VALIDATE = 0x0020;
var BIF_NEWDIALOGSTYLE = 0x0040;
var BIF_BROWSEINCLUDEURLS = 0x0080;
var BIF_UAHINT = 0x0100;
var BIF_NONEWFOLDERBUTTON = 0x0200;
var BIF_NOTRANSLATETARGETS = 0x0400;
var BIF_BROWSEFORCOMPUTER = 0x1000;
var BIF_BROWSEFORPRINTER = 0x2000;
var BIF_BROWSEINCLUDEFILES = 0x4000;
var BIF_SHAREABLE = 0x8000;
var BIF_USENEWUI = (BIF_NEWDIALOGSTYLE | BIF_EDITBOX);


// Windows ShowWindow constants.
// Also used in other functions like ShellExecute.
// More information is available here:
// http://msdn.microsoft.com/en-us/library/ms633548.aspx
var SW_HIDE = 0;
var SW_SHOWNORMAL = 1;
var SW_NORMAL = 1;
var SW_SHOWMINIMIZED = 2;
var SW_SHOWMAXIMIZED = 3;
var SW_MAXIMIZE = 3;
var SW_SHOWNOACTIVATE = 4;
var SW_SHOW = 5;
var SW_MINIMIZE = 6;
var SW_SHOWMINNOACTIVE = 7;
var SW_SHOWNA = 8;
var SW_RESTORE = 9;
var SW_SHOWDEFAULT = 10;
var SW_FORCEMINIMIZE = 11;

Martin Verlaan

unread,
Feb 9, 2015, 9:36:25 AM2/9/15
to php...@googlegroups.com
Thanks a lot Paul, it's working now!

Op maandag 9 februari 2015 08:29:45 UTC+1 schreef ZZEE Groups:

Martin Verlaan

unread,
Feb 11, 2015, 4:45:27 AM2/11/15
to php...@googlegroups.com
One more question: 

Is it also posiible to do add multiple extensions to one item in dialog.extensionFilter, something like this?

dialog.extensionFilter = 'All image files|(*.bmp;*.gif;*.jpg;*.png)||';

ZZEE Groups

unread,
Feb 11, 2015, 5:55:14 AM2/11/15
to php...@googlegroups.com
Yes. Please look in the Windows API documentation how to do this.

Miike

unread,
Feb 11, 2015, 6:06:11 AM2/11/15
to php...@googlegroups.com
This is definitely possible. I used this some time ago with a video player to limit the file types to MOV, AVI and MP4.
Reply all
Reply to author
Forward
0 new messages