Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Getfile question
Message
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Getfile question
Miscellaneous
Thread ID:
00353361
Message ID:
00353361
Views:
48
I'm using the following code to allow users to open a file that is used by my app:

*********************************
*
* Method import_data
*
*******************************

gcImportST = GETFILE('txt', 'IMPORT FILE', 'Import', 0,;
'Select the NSF text file to import')
gcImportST = ["] + gcImportST + ["]

DO CASE

CASE 'Untitled' $ gcImportST
=Messagebox(" NSF File Import Cancelled",48, "NSF Notices")
RETURN
CASE EMPTY(gcImportST)
=Messagebox(" NSF File Import Cancelled",48, "NSF Notices")
RETURN
CASE gcImportST = ["]+""+["]
=Messagebox(" NSF File Import Cancelled",48, "NSF Notices")
RETURN
CASE right(alltrim(gcImportST),5) <> '.TXT"'
=Messagebox("ERROR - Import file must be a text file ;
with a '.txt' extension - please try again", 16, ;
"NSF Notices")
RETURN
OTHERWISE
gcImportST1 = CHRTRAN((gcImportST), '""', '') thisform.import_data1() && proceed with the import and parsing

ENDCASE

**********

Question: IF a user doesn't select a file - but rather types in a non-existent file name - an error is generated. How should I verify that the filename they typed in (for the users that don't simply select the file) is a file that exists in the app directory.

Thanks.
Al Williams

Anola MB, CANADA
Next
Reply
Map
View

Click here to load this message in the networking platform