Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

I need some formatting help

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • I need some formatting help

    I have some files that I upload via ftp and some are *.doc and some *.docx and also *.pdf. I am having trouble with formatting the correct extensions and also working with spaces in file name, if there is file names and it's a *.docx 4 char extension all works but if not I get errors. I have prepared some sample code with special information removed for security purposes.

    The process is that user selects file to upload I use the shell to run and AES encryption to the file and then delete the unencrypted file, and upload to server via ftp then delete the uploaded *.aes encrypted file, write to sql database the filename derived from the description. Like I said works fine if there is a 4 char extension and no spaces in the filename of the selected file.

    Here is the code I am using
    Code:
    'Date Created: 31-Mar-2016 09:59:28 AM
    'Last Updated: 21-Feb-2018 01:59:58 PM
    'Created By  : Steve
    'Updated By  : hubby
    'Prompt for text and store result in a variable called 'ftype'.
    'Get 'Value' property of 'Idclientd' in Form 'clientstart' .
    DIM window_name as C
    window_name = ":"+"credmaster"
    DIM varP_Object as p
    'Get a pointer to the specified window
    varP_Object = obj(window_name)
    'Check if the specified window exists
    if .not. is_object(varP_Object) then 
    	ui_msg_box("Error","The window '"+window_name+"' does not exist.",ui_stop_symbol)
    else
    	DIM SHARED clientid AS n
    	clientid = varP_Object:Idclientd.value
    end if
    dim prmpt_title as c 
    dim prmpt_prompt as c 
    dim prmpt_default as c 
    
    prmpt_title = "Description"
    prmpt_prompt = "File Description"
    prmpt_default = ""
    	
    DIM SHARED ftype AS C
    	
    ftype = ui_get_text(prmpt_title,prmpt_prompt,prmpt_default)
    	'Prompt for a filename and store result in a variable called 'fname'.
    'Prompt for a filename and store result in a variable called 'fname'.
    dim prmpt_title as c 
    dim prmpt_filter as c 
    dim prmpt_default as c 
    dim prmpt_flag as c 
    
    prmpt_title = a5_eval_expression("=\"Choose File\"",local_variables())
    prmpt_filter = "(*.*)"
    prmpt_default = ""
    
    DIM fname AS C
    
    fname = ui_get_file( a5_eval_expression(prmpt_title,local_variables()),prmpt_filter,prmpt_default,"X")
    
    
    
    if ftype ="" 
    	ui_msg_box("error","You Didn't Choose a File Description",UI_STOP_SYMBOL)
    	end 
    	end if
    	if fname="" 
    		ui_msg_box("error","You Didn't Choose a File",UI_STOP_SYMBOL)
    		end 
    		end if
    sys_shell_wait("c:\housing\aescrypt -e -p magic_key_removed "fname,.F.)
    dim extn as c
    extn = right(fname,4)
    xbasic_wait_for_idle(2)
    
    dim st as c
    dim en as c
    st = "\\"
    
    en = " "
    dim shared upname as c
     upname=".aes"
    dim ftsend as c
    ftsend=ftype+"."+extn+upname
    				
    				
    	cmd = <<%a%
    connect|********
    onerror|error|Could not connect
    login|*****|*******
    onerror|error|Could not log in
    mkdir|%a%"/srv/ftp/clientdocs/credit/" + clientid + crlf() + <<%a%
    onerror|quit
    quit 
    %a% 
    ftp_script_run_silent(cmd, .t.)
    				
    							
    				
    ftp_put_file("192.168.69.149", "******", "******", fname+".aes","/srv/ftp/clientdocs/credit/"+clientid+"/"+ftsend,.f.,"Uploading File")
    'Insert a new record into a remote SQL database.
    'DIM a connection variable
    DIM cn as SQL::Connection
    dim flagResult as l 
    flagResult = cn.open("::Name::pat")
    if flagResult = .f. then 
    	ui_msg_box("Error","Could not connect to database. Error reported was: " + crlf() + cn.CallResult.text)
    	end 
    end if
    
    'Specify that we are using Portable SQL syntax
    cn.PortableSQLEnabled = .t.
    dim shared agent as c
    agent=user_name()
    'Dim a SQL arguments object, create arguments and set their values
    DIM args as sql::arguments
    
    
    if a5_eval_valid_expression("=clientid",local_variables()) then 
    	args.add("idclientd",convert_type(a5_eval_expression("=clientid",local_variables()),"N"))
    end If
    if a5_eval_valid_expression("=ftsend",local_variables()) then 
    	args.add("doc_type",convert_type(a5_eval_expression("=ftsend",local_variables()),"C"))
    end If
    if a5_eval_valid_expression("=agent",local_variables()) then 
    	args.add("doc_who",convert_type(a5_eval_expression("=agent",local_variables()),"C"))
    end If
    
    
    dim sqlInsertStatement as c 
    sqlInsertStatement = <<%txt%
    INSERT INTO cred_docs  (idclientd, doc_type, doc_who) VALUES (:idclientd, :doc_type, :doc_who)
    %txt%
    
    dim flag as l 
    flag = cn.Execute(sqlInsertStatement,args)
    if flag = .f. then 
    	ui_msg_box("Error","Record was not inserted. Error reported was: " + crlf(2) + cn.CallResult.text,UI_STOP_SYMBOL)
    else
    	if cn.AffectedRows() = 1 then 
    		ui_msg_box("Notice","File Has Been  Uploaded..",UI_INFORMATION_SYMBOL)
    	else
    		ui_msg_box("Error","File Has Not Been Uploaded." ,UI_STOP_SYMBOL)
    	end if 
    end if 
    cn.close()  
    xbasic_wait_for_idle(1)
    file.remove(fname)
    file.remove(ftsend)
    delete fname
    delete ftsend
    https://www.housingeducator.org
    k3srg

  • #2
    Re: I need some formatting help

    extn = file.filename_parse(fname,"E")

    will return the extension with the period as in .doc or .docx. Strtran(file.filename_parse(fname,"E"),".","") will remove the period.

    Seems

    sys_shell_wait("c:\housing\aescrypt -e -p magic_key_removed "fname,.F.)

    should be

    sys_shell_wait("c:\housing\aescrypt -e -p magic_key_removed "+fname,.F.)
    There can be only one.

    Comment


    • #3
      Re: I need some formatting help

      I had the +fname in there must have removed it when editing. The thing I'm having the hardest time with is the spaces in the file name when running the sys_shell_wait() command because some people save files such as ex"this file.txt" instead of "this_file.txt" and the command line don't like spaces in the file names

      so the command would look like

      sys_shell_wait("c:\housing\aescrypt -e -p magic_key_removed c:\Desktop\file to test.doc",.F.) and the encryption program won't run because it comes backs can't find c:\Desktop\file i'm going to ponder on this for a little bit because i'm sure there is a way i can work the string and add chr(092) before and after the selected file somehow.
      Last edited by steve745; 02-21-2018, 04:14 PM.
      https://www.housingeducator.org
      k3srg

      Comment


      • #4
        Re: I need some formatting help

        Rename the file for them.

        Just after

        fname = ui_get_file( a5_eval_expression(prmpt_title,local_variables()),prmpt_filter,prmpt_default,"X")

        add

        if at(" ",fname) > 0
        file.rename(fname,strtran(fname," ","_"))
        end if

        This will replace spaces with underlines. You really don't have to test for at(" ",fname) > 0. file.rename(fname,strtran(fname," ","_")) won't alter the filename if there are no spaces.
        There can be only one.

        Comment


        • #5
          Re: I need some formatting help

          ok so I put this in the interactive window because I keep getting file not found
          Code:
          dim prmpt_title as c 
          dim prmpt_prompt as c 
          dim prmpt_default as c 
          
          prmpt_title = "Description"
          prmpt_prompt = "File Description"
          prmpt_default = ""
          	
          DIM SHARED ftype AS C
          	
          ftype = ui_get_text(prmpt_title,prmpt_prompt,prmpt_default)
          	'Prompt for a filename and store result in a variable called 'fname'.
          'Prompt for a filename and store result in a variable called 'fname'.
          dim prmpt_title as c 
          dim prmpt_filter as c 
          dim prmpt_default as c 
          dim prmpt_flag as c 
          
          prmpt_title = a5_eval_expression("=\"Choose File\"",local_variables())
          prmpt_filter = "(*.*)"
          prmpt_default = ""
          
          DIM fname AS C
          
          fname = ui_get_file( a5_eval_expression(prmpt_title,local_variables()),prmpt_filter,prmpt_default,"X")
          'if at(" ",fname) > 0
          file.rename(fname,strtran(fname," ","_"))
          'end if
          ?fname
          = "C:\Users\hubby\Desktop\credmed\Contract_and_CC_auth_addendum\Credit Card Authorization Credit Repair.docx"
          
          'tried with fname=file.rename(fname,strtran(fname," ","_"))
          ?fname
          = "0"
          it is renaming the file but how to I tell fname the new renamed filename?
          https://www.housingeducator.org
          k3srg

          Comment


          • #6
            Re: I need some formatting help

            Nevermind just used help and put in file.rename and got the correct way to get the new filename thanks stan very much
            https://www.housingeducator.org
            k3srg

            Comment


            • #7
              Re: I need some formatting help

              fname=strtran(fname," ","_")
              There can be only one.

              Comment


              • #8
                Re: I need some formatting help

                OK so I made some changes because I found that a user has a path such as c:\user\this user\Downloads and the file rename was giving errors and now I'm testing and I got stuck at the ftp transfer

                the code im using is edited for security purposes
                Code:
                'Date Created: 31-Mar-2016 09:59:28 AM
                'Last Updated: 21-Feb-2018 04:50:28 PM
                'Created By  : Steve
                'Updated By  : hubby
                'Prompt for text and store result in a variable called 'ftype'.
                'Get 'Value' property of 'Idclientd' in Form 'clientstart' .
                DIM window_name as C
                window_name = ":"+"credmaster"
                DIM varP_Object as p
                'Get a pointer to the specified window
                varP_Object = obj(window_name)
                'Check if the specified window exists
                if .not. is_object(varP_Object) then 
                	ui_msg_box("Error","The window '"+window_name+"' does not exist.",ui_stop_symbol)
                else
                	DIM SHARED clientid AS n
                	clientid = varP_Object:Idclientd.value
                end if
                dim prmpt_title as c 
                dim prmpt_prompt as c 
                dim prmpt_default as c 
                
                prmpt_title = "Description"
                prmpt_prompt = "File Description"
                prmpt_default = ""
                	
                DIM SHARED ftype AS C
                	
                ftype =alltrim(ui_get_text(prmpt_title,prmpt_prompt,prmpt_default))
                'Prompt for a filename and store result in a variable called 'fname'.
                'Prompt for a filename and store result in a variable called 'fname'.
                dim prmpt_title as c 
                dim prmpt_filter as c 
                dim prmpt_default as c 
                dim prmpt_flag as c 
                
                prmpt_title = a5_eval_expression("=\"Choose File\"",local_variables())
                prmpt_filter = "(*.*)"
                prmpt_default = ""
                
                DIM shared fname AS C
                
                fname =alltrim(ui_get_file( a5_eval_expression(prmpt_title,local_variables()),prmpt_filter,prmpt_default,"X"))
                dim dr as c
                dr=file.filename_parse(fname,"d")
                dim pth as c
                pth=file.filename_parse(fname,"p")
                dim fext as c
                fext=file.filename_parse(fname,"e")
                dim fn as c
                fn=file.filename_parse(fname,"ne")
                dim fupath as c
                fupath=alltrim(chr(34)+dr+pth+fn+chr(34))
                dim encfu as c
                encfu=alltrim(chr(34)+dr+pth+fn+".aes"+chr(34))
                'if at(" ",fn) > 0
                'file.rename(dr+pth+fn,strtran(dr+pth+fn," ","_"))
                'end if
                
                
                if ftype ="" 
                	ui_msg_box("error","You Didn't Choose a File Description",UI_STOP_SYMBOL)
                	end 
                	end if
                	if fname="" 
                		ui_msg_box("error","You Didn't Choose a File",UI_STOP_SYMBOL)
                		end 
                		end if
                sys_shell_wait(chr(34)+"c:\housing\aescrypt -e -p ******** "fupath)
                
                'dim extn as c
                'extn=Strtran(file.filename_parse(fname,"E"),".","")
                
                'xbasic_wait_for_idle(2)
                
                'dim st as c
                'dim en as c
                'st = "\\"
                '
                'en = " "
                dim upname as c
                 upname=".aes"
                'dim ftsend as c
                'ftsend=ftype+"."+upname
                dim ftppath as c
                ftppath =alltrim("/srv/ftp/clientdocs/credit/"+clientid+chr(47)+ftype+fext+upname)
                	cmd = <<%a%
                connect|*****
                onerror|error|Could not connect
                login|*****|*******
                onerror|error|Could not log in
                mkdir|%a%"/srv/ftp/clientdocs/credit/" + clientid + crlf() + <<%a%
                onerror|quit
                quit 
                %a% 
                ftp_script_run_silent(cmd, .t.)
                				
                		xbasic_wait_for_idle(2)					
                				
                FTP_FILE_XFER("******","****","****",alltrim(encfu),alltrim(ftppath),"put")
                'Insert a new record into a remote SQL database.
                'DIM a connection variable
                'DIM cn as SQL::Connection
                'dim flagResult as l 
                'flagResult = cn.open("::Name::pat")
                'if flagResult = .f. then 
                '	ui_msg_box("Error","Could not connect to database. Error reported was: " + crlf() + cn.CallResult.text)
                '	end 
                'end if
                '
                ''Specify that we are using Portable SQL syntax
                'cn.PortableSQLEnabled = .t.
                'dim shared agent as c
                'agent=user_name()
                ''Dim a SQL arguments object, create arguments and set their values
                'DIM args as sql::arguments
                '
                '
                'if a5_eval_valid_expression("=clientid",local_variables()) then 
                '	args.add("idclientd",convert_type(a5_eval_expression("=clientid",local_variables()),"N"))
                'end If
                'if a5_eval_valid_expression("=ftsend",local_variables()) then 
                '	args.add("doc_type",convert_type(a5_eval_expression("=ftsend",local_variables()),"C"))
                'end If
                'if a5_eval_valid_expression("=agent",local_variables()) then 
                '	args.add("doc_who",convert_type(a5_eval_expression("=agent",local_variables()),"C"))
                'end If
                '
                '
                'dim sqlInsertStatement as c 
                'sqlInsertStatement = <<%txt%
                'INSERT INTO cred_docs  (idclientd, doc_type, doc_who) VALUES (:idclientd, :doc_type, :doc_who)
                '%txt%
                '
                'dim flag as l 
                'flag = cn.Execute(sqlInsertStatement,args)
                'if flag = .f. then 
                '	ui_msg_box("Error","Record was not inserted. Error reported was: " + crlf(2) + cn.CallResult.text,UI_STOP_SYMBOL)
                'else
                '	if cn.AffectedRows() = 1 then 
                '		ui_msg_box("Notice","File Has Been  Uploaded..",UI_INFORMATION_SYMBOL)
                '	else
                '		ui_msg_box("Error","File Has Not Been Uploaded." ,UI_STOP_SYMBOL)
                '	end if 
                'end if 
                'cn.close()  
                'xbasic_wait_for_idle(1)
                'file.remove(fupath)
                'file.remove(fupath+".aes")
                'delete fname
                'delete ftsend
                'delete fupath
                'delete pth
                'delete fn
                'delete dr
                I'm testing as I go and when i get to the ftp upload i keep getting error here is a screen shot
                alphaftperror.png

                I have put alltrim every where and for some reason I'm missing it prob don't need the alltrim but I was trying anything at this point
                Last edited by steve745; 02-26-2018, 10:52 PM. Reason: sec
                https://www.housingeducator.org
                k3srg

                Comment


                • #9
                  Re: I need some formatting help

                  i think i see it looking again the " at the end of aes gonna try to remove it
                  https://www.housingeducator.org
                  k3srg

                  Comment


                  • #10
                    Re: I need some formatting help

                    ok i got it after doing some reworking will post correction soon just gotta clear info
                    https://www.housingeducator.org
                    k3srg

                    Comment


                    • #11
                      Re: I need some formatting help

                      So here is the code for others if ever needed and it will be here for reference if I ever need the coding again.

                      Code:
                      'Date Created: 31-Mar-2016 09:59:28 AM
                      'Last Updated: 21-Feb-2018 04:50:28 PM
                      'Created By  : Steve
                      'Updated By  : hubby
                      'Prompt for text and store result in a variable called 'ftype'.
                      'Get 'Value' property of 'Idclientd' in Form 'clientstart' .
                      DIM window_name as C
                      window_name = ":"+"credmaster"
                      DIM varP_Object as p
                      'Get a pointer to the specified window
                      varP_Object = obj(window_name)
                      'Check if the specified window exists
                      if .not. is_object(varP_Object) then 
                      	ui_msg_box("Error","The window '"+window_name+"' does not exist.",ui_stop_symbol)
                      else
                      	DIM SHARED clientid AS n
                      	clientid = varP_Object:Idclientd.value
                      end if
                      dim prmpt_title as c 
                      dim prmpt_prompt as c 
                      dim prmpt_default as c 
                      
                      prmpt_title = "Description"
                      prmpt_prompt = "File Description"
                      prmpt_default = ""
                      	
                      DIM SHARED ftype AS C
                      	
                      ftype =alltrim(ui_get_text(prmpt_title,prmpt_prompt,prmpt_default))
                      'Prompt for a filename and store result in a variable called 'fname'.
                      'Prompt for a filename and store result in a variable called 'fname'.
                      dim prmpt_title as c 
                      dim prmpt_filter as c 
                      dim prmpt_default as c 
                      dim prmpt_flag as c 
                      
                      prmpt_title = a5_eval_expression("=\"Choose File\"",local_variables())
                      prmpt_filter = "(*.*)"
                      prmpt_default = ""
                      
                      DIM shared fname AS C
                      
                      fname =alltrim(ui_get_file( a5_eval_expression(prmpt_title,local_variables()),prmpt_filter,prmpt_default,"X"))
                      dim dr as c
                      dr=file.filename_parse(fname,"d")
                      dim pth as c
                      pth=file.filename_parse(fname,"p")
                      dim fext as c
                      fext=file.filename_parse(fname,"e")
                      dim fn as c
                      fn=file.filename_parse(fname,"ne")
                      dim fupath as c
                      fupath=chr(34)+dr+pth+fn+chr(34)
                      dim encfu as c
                      encfu=dr+pth+fn+".aes"
                      'if at(" ",fn) > 0
                      'file.rename(dr+pth+fn,strtran(dr+pth+fn," ","_"))
                      'end if
                      
                      
                      if ftype ="" 
                      	ui_msg_box("error","You Didn't Choose a File Description",UI_STOP_SYMBOL)
                      	end 
                      	end if
                      	if fname="" 
                      		ui_msg_box("error","You Didn't Choose a File",UI_STOP_SYMBOL)
                      		end 
                      		end if
                      sys_shell_wait(chr(34)+"c:\housing\aescrypt -e -p ************* "fupath)
                      
                      'dim extn as c
                      'extn=Strtran(file.filename_parse(fname,"E"),".","")
                      
                      'xbasic_wait_for_idle(2)
                      
                      'dim st as c
                      'dim en as c
                      'st = "\\"
                      '
                      'en = " "
                      dim upname as c
                       upname=".aes"
                      dim ftsend as c
                      ftsend=ftype+fext+upname
                      dim ftppath as c
                      ftppath =alltrim("/srv/ftp/clientdocs/credit/"+clientid+chr(47)+ftype+fext+upname)
                      	cmd = <<%a%
                      connect|******
                      onerror|error|Could not connect
                      login|****|*****
                      onerror|error|Could not log in
                      mkdir|%a%"/srv/ftp/clientdocs/credit/" + clientid + crlf() + <<%a%
                      onerror|quit
                      quit 
                      %a% 
                      ftp_script_run_silent(cmd, .t.)
                      				
                      		xbasic_wait_for_idle(2)					
                      				
                      FTP_FILE_XFER("****","****","******",alltrim(encfu),alltrim(ftppath),"put",.F.,"File Uploading")
                      'Insert a new record into a remote SQL database.
                      'DIM a connection variable
                      DIM cn as SQL::Connection
                      dim flagResult as l 
                      flagResult = cn.open("::Name::pat")
                      if flagResult = .f. then 
                      	ui_msg_box("Error","Could not connect to database. Error reported was: " + crlf() + cn.CallResult.text)
                      	end 
                      end if
                      
                      'Specify that we are using Portable SQL syntax
                      cn.PortableSQLEnabled = .t.
                      dim shared agent as c
                      agent=user_name()
                      'Dim a SQL arguments object, create arguments and set their values
                      DIM args as sql::arguments
                      
                      
                      if a5_eval_valid_expression("=clientid",local_variables()) then 
                      	args.add("idclientd",convert_type(a5_eval_expression("=clientid",local_variables()),"N"))
                      end If
                      if a5_eval_valid_expression("=ftsend",local_variables()) then 
                      	args.add("doc_type",convert_type(a5_eval_expression("=ftsend",local_variables()),"C"))
                      end If
                      if a5_eval_valid_expression("=agent",local_variables()) then 
                      	args.add("doc_who",convert_type(a5_eval_expression("=agent",local_variables()),"C"))
                      end If
                      
                      
                      dim sqlInsertStatement as c 
                      sqlInsertStatement = <<%txt%
                      INSERT INTO cred_docs  (idclientd, doc_type, doc_who) VALUES (:idclientd, :doc_type, :doc_who)
                      %txt%
                      
                      dim flag as l 
                      flag = cn.Execute(sqlInsertStatement,args)
                      if flag = .f. then 
                      	ui_msg_box("Error","Record was not inserted. Error reported was: " + crlf(2) + cn.CallResult.text,UI_STOP_SYMBOL)
                      else
                      	if cn.AffectedRows() = 1 then 
                      		ui_msg_box("Notice","File Has Been  Uploaded..",UI_INFORMATION_SYMBOL)
                      	else
                      		ui_msg_box("Error","File Has Not Been Uploaded." ,UI_STOP_SYMBOL)
                      	end if 
                      end if 
                      cn.close()  
                      xbasic_wait_for_idle(1)
                      file.remove(dr+pth+fn)
                      file.remove(dr+pth+fn+".aes")
                      delete fname
                      delete ftsend
                      delete fupath
                      delete pth
                      delete fn
                      delete dr
                      it's not as neat as it could be and I'm sure there is another way or several other ways to do the same thing but this is what works for me.
                      https://www.housingeducator.org
                      k3srg

                      Comment

                      Working...
                      X