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

upload file using aftervalidate event

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

    upload file using aftervalidate event

    I'm currently trying to allow the user the option of uploading file, along with filling out other various information. I'm currently using a dialog and have the following code in one of the textboxes in the freeform layout:

    <b>File Upload </b><input type="file" name="FileToUpload" >

    I'm trying to utilize the aftervalidate event to obtain the filename that the browse button comes back with.

    Here's the code I tried so far and it comes Argument is incorrect data type


    aftervalidate

    if FileToUpload.filename = ""
    fn="No file"

    else
    fn = "[PathAlias.ADB_Path]\images\\" + FileToUpload.filename
    file.from_blob(fn, FileToUpload.data)
    end if

    tbl = table.open("[PathAlias.ADB_Path]\issue.dbf")
    tbl.enter_begin()
    tbl.file = fn
    tbl.enter_end(.t.)
    tbl.close()

    #2
    Re: upload file using aftervalidate event

    This trick could do it. Open your A5W page and insert the part in red as follows. However, what you have in AfterValidate, I have in my A5W page, following code originally available in the Alpha Help. I do, like you, divert from that help and have my form fields in the Dialog under a Freeform area.
    Note below that x_upload would be replaced with the name of your component, consistent with other x_mycomponent tags in the page.

    Please let me know if it works. I worked very hard to get this upload feature in to a dialog component so I could use other A5 features not available using the method shown in the Alpha help.

    Code:
     
    ?x_upload.Output.Head.JavaScript
    ?x_upload.Output.Head.CSS_Link
    %>
    <%a5
    [B][COLOR=darkred]'MY FORM REPLACEMENT CODE
    x_upload.Output.Body.Dialog_HTML = stritran(x_upload.Output.Body.Dialog_HTML,"method=\"post\"","method=\"post\" enctype=\"multipart/form-data\"")
    %>[/COLOR][/B]
    <!--Alpha Five Temporary Code Start - Will be automatically removed when page is published -->
    Steve Wood
    See my profile on IADN

    Comment


      #3
      Re: upload file using aftervalidate event

      Attached is what I tried. It comes back with a statement "false". Do I have it right place?

      Comment


        #4
        Re: upload file using aftervalidate event

        I don't think so. You actually replaced an existing piece of code, you should just be adding what I provided. Return that line to what it was before, and ADD in the line I gave. The position for it probably does not matter, but you should be able to find the exact place I put mine from the example.

        Note - I'm not an expert with the code in the A5W page, everything I know I lifted from other examples, mostly provided by Jerry.
        Steve Wood
        See my profile on IADN

        Comment


          #5
          Re: upload file using aftervalidate event

          Steve:

          I was able to get this to work using Rching's example along with your added code. I would like to see how you did this by placing all the code on the a5w page. I am also trying to provide the user some feedback when the file is succesfully uploaded as demonstrated in the help file. I am getting somewhat confused going back and forth between the aftervalidate code in the dialoge and the a5w page code. Thanks for any insight!

          Steve

          Comment


            #6
            Re: upload file using aftervalidate event

            Hi,

            I have configured this on my application. Works great. However, how can i prevent the whole path being stored? All i need is the filename itself.

            Denis

            Comment


              #7
              Re: upload file using aftervalidate event

              Dennis,

              Did you get this to work? I too need to allow my clients to upload a couple of files and list the file name and date in a field that could be downloaded by another person if they click on it.

              If you got yours to work, would you mind posting the code (and its location) for me to examine so I can figure this out?

              Thanks,

              Mike Scholin

              Comment


                #8
                Re: upload file using aftervalidate event

                Michael,

                This one was never resolved. Sorry.

                Denis

                Comment


                  #9
                  Re: upload file using aftervalidate event

                  If you simply need to remove the path from the filename, look at file.filename_parse()

                  Lenny Forziati
                  Vice President, Internet Products and Technical Services
                  Alpha Software Corporation

                  Comment


                    #10
                    Re: upload file using aftervalidate event

                    Hi,

                    I have used the code supplied by rching and Steve Wood. I now have a grid with two fields;

                    Document_Name (Text)
                    VIEW (Link field)


                    The problem i now have is;

                    1. When i upload a file, how can a user view it. As normally, i would have to upload it in Alpha and publish it.

                    2. The app is based on a user_id value which determines who can see what. How can i store the files in seperate directories. e.g.

                    USER 1 = /images/user1
                    USER 2 = /images/user2
                    USER 3 = /images/user3


                    2. With the LINK, how can i point it to the file which is related to the 'document_name'?

                    1-DOCUMENT_NAME --------- VIEW
                    2-DOCUMENT_NAME --------- VIEW
                    3-DOCUMENT_NAME --------- VIEW
                    4-DOCUMENT_NAME --------- VIEW


                    This is a new area for me, any help will be really appreciated.

                    Denis

                    Comment


                      #11
                      Re: upload file using aftervalidate event

                      Originally posted by Steve Wood View Post
                      This trick could do it. Open your A5W page and insert the part in red as follows. However, what you have in AfterValidate, I have in my A5W page, following code originally available in the Alpha Help. I do, like you, divert from that help and have my form fields in the Dialog under a Freeform area.
                      Note below that x_upload would be replaced with the name of your component, consistent with other x_mycomponent tags in the page.

                      Please let me know if it works. I worked very hard to get this upload feature in to a dialog component so I could use other A5 features not available using the method shown in the Alpha help.

                      Code:
                       
                      ?x_upload.Output.Head.JavaScript
                      ?x_upload.Output.Head.CSS_Link
                      %>
                      <%a5
                      [B][COLOR=darkred]'MY FORM REPLACEMENT CODE
                      x_upload.Output.Body.Dialog_HTML = stritran(x_upload.Output.Body.Dialog_HTML,"method=\"post\"","method=\"post\" enctype=\"multipart/form-data\"")
                      %>[/COLOR][/B]
                      <!--Alpha Five Temporary Code Start - Will be automatically removed when page is published -->
                      I tried using this code to add a 'file upload' function on my page but the page I've added it to also has 3 drop down boxes that link to each other (i.e. the list in the 2nd drop down box depends on the selection from the 1st drop down box, etc.). These drop down boxes were working fine before I added the new line of code to make the file upload function work, now the drop down boxes come up with the following error:

                      Error creating list :Expected value

                      Does anyone know how I can fix this? I'm VERY new to Alpha Five and need all the help I can get!

                      Comment

                      Working...
                      X