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

Attachments

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

    Attachments

    Newbie (no longer in 30 day trial mode...purchased today :-) )

    Anyway, can someone direct me to a good primer on attachments?

    I need to learn how to attach files (jpg/doc/pdf) to a record (embed the path in a field in the record?).

    And I need to learn how to allow a user to click on a link to one of the attached files.

    Thanks!

    #2
    Re: Attachments

    Here is a general description of what I want to figure out how to do:

    User looks at a grid that indicates that there is a file attached to the record. This is accomplished by a .T. / .F. field on a record in the DB.

    The user has the ability to click on the link which opens another grid.

    I want this second grid to display a list of URL's that point to either .jpg or .pdf files. These URL's are displayed as links.

    Now I want the user to be able to be able to click one or more of these links and have the .jpg or .pdf be displayed in the browser.

    If someone could point me to some documentation or general instructions how to accomplish this, I would be very grateful. Thanks in advance.

    Comment


      #3
      Re: Attachments

      Here is part of an answer for you. This is a bit complicated for a newbe, but here goes.

      I use a pop up window to manage attachments as shown in screen1, attached. The source for this window is:

      Code:
       
       <html><head>
      <%a5
      '==== check session variable for a selected attachment
      if eval_valid("session.SelectedFile")=.f.
       dim session.SelectedFile as C = "None"
      end if
      '==== setup for an upload
      Dim vMsg1 as C = "Upload Supporting Documents for this CAR"
      if eval_valid("cmd")
          file.from_blob("D:\A5WAS\Pages\Uploads\\"+session.car.id+"."+FileToUpload.filename, FileToUpload.data)
       if file.size("D:\A5WAS\Pages\Uploads\\"+session.car.id+"."+FileToUpload.filename")=0
        vMsg1 = "Please use the Browse button to navigate to the file before uploading."
       else
           vMsg1 = "<a href=\"/" + FileToUpload.filename + "\" target=\"_blank\">" + FileToUpload.filename + "</a> was uploaded."
       end if
      end if
      '==== start the CAR_Attach component
      Delete tmpl_CAR_Attach
      DIM tmpl_CAR_Attach as P
      tmpl_CAR_Attach = a5w_load_component("CAR_Attach")
      with tmpl_CAR_Attach
       componentName = "CAR_Attach"
      end with 
      delete x_CAR_Attach
      dim x_CAR_Attach as p
      x_CAR_Attach = a5w_run_Component(tmpl_CAR_Attach)
      if x_CAR_Attach.RedirectURL <> "" then 
       response.redirect(x_CAR_Attach.redirectURL)
       end
      end if 
      ?x_CAR_Attach.Output.Head.JavaScript
      ?x_CAR_Attach.Output.Head.CSS_Link
      %>
      <!--Alpha Five Temporary Code Start - Will be automatically removed when page is published -->
      <!--CSS for tmpl_CAR_Attach -->
      <link rel="stylesheet" type="text/css" href="[URL]file:///C:/Calmax/Calmax.WebProjects/Default.WebProject/css/CalMax/style.css[/URL]">
      <!--Alpha Five Temporary Code End -->
      <meta name="generator" content="Alpha Five HTML Editor Version 8 Build 1173-3034">
      <title>CAR Attachments</title>
      </head>
      <body class="CalMaxPageBODY">
      <table width="800" border="0" cellpadding="0" cellspacing="0">
      <tr><td align="left" valign="top" width="112" style="BORDER-RIGHT: #000000 2px solid" >
       <p align="center" style="MARGIN: 0px"><form><input type="button" value="close this window" onclick="window.close()"></form></p>
      </td>
      <td>
       <p><%a5 ?vMsg1 %></p>
       <p><form action="<%a5 ?request.script_name %>" method ="post" enctype="multipart/form-data">
       <input type="file" name="FileToUpload">&nbsp;<input type="submit" name="cmd" value="Upload File"></form></p>
      </td></tr>
      <tr><td>&nbsp;</td>
      <td valign="top" align="left" width="688">
       <table>
        <tr><td><%A5 ?x_CAR_Attach.Output.Body.Xbasic_Code_Errors %></td></tr>
        <tr><td><%A5 ?x_CAR_Attach.Output.Body.Dialog_HTML %></td></tr>
       </table>
      </td>
      </tr>
      <tr><td>&nbsp;</td>
      <td>
       <br>
       <p>The selected attachment is <%a5 ?session.SelectedFile %></p>
       <p><a href="<%a5 ?session.SelectedFile %>" target="_blank">&nbsp;Open the selected attachment</a></p>
      </td></tr>
      </table>
      </body></html>
      The suporting documents list is a dialog component with a single multiselect dropdown box. The list is populated in the initialize event with the following:

      Code:
       
      Dim session.CAR.Id as C
      Dim vAttach_List as C
      vFiles="D:\A5WAS\Pages\Uploads\\"+alltrim(session.CAR.Id)+".*.*"
      vAttach_List=filefind.get(vFiles,0,"N")
      When the user selects an attachment and clicks submit, the aftervalidate is
      Code:
       
      session.SelectedFile="uploads/"+alltrim(CurrentForm.Controls.vAttach.value)
      That should get you started.

      Pat
      Pat Bremkamp
      MindKicks Consulting

      Comment


        #4
        Re: Attachments

        Thank you. I will work with this and probably have some questions <-understatement.

        Slim

        Comment


          #5
          Re: Attachments

          Pat,
          What code is executed when the user clicks on: "Open the selected attachment"?

          And, can you supply the code for the component "Car_attach"?

          And thanks again for helping.

          Slim

          Comment


            #6
            Re: Attachments

            Slim,

            You are obviously making progress! Yu are asking good questions.

            The 'open selected attachment' is handled by the browser. There is no code to run.

            The attach dialog box setup is shown in the picture. i think before i said it was multiselect, but it's not. It is single select, but multiline.

            Initialize event is

            Code:
             
            vFiles="D:\A5WAS\Pages\Uploads\\"+alltrim(session.CAR.Id)+".*.*"
            vAttach_List=filefind.get(vFiles,0,"N")
            The activate event is:

            Code:
             
            vFiles="D:\A5WAS\Pages\Uploads\\"+alltrim(session.CAR.Id)+".*.*"
            vAttach_List=filefind.get(vFiles,0,"N")
            if line_count(vAttach_List)>0
             tbl=table.open("[PathAlias.ADB_Path]\car_log")
             indx=tbl.index_primary_put("CAR_Id")
             vRecNo=tbl.fetch_find(session.CAR.Id)
             if vRecNo>0 'was found
              tbl.change_begin()
              tbl.Attach=.t.
              tbl.change_end()
             end if
             tbl.close()
            end if
            The purpose of this extra code is to set a logical field if any attachments exist, so I can have an indicator. If anyone has a better way, I'd love to hear it!

            the afterValidate is simply

            Code:
             
            session.SelectedFile="uploads/"+alltrim(CurrentForm.Controls.vAttach.value)
            Pat Bremkamp
            MindKicks Consulting

            Comment


              #7
              Re: Attachments

              ok. With the insight gained from your code, I was able to get it working...

              But, one thing I don't understand yet is the logic behind the location the files are uploaded to.

              In your example they are in "D:\A5WAS\Pages\Uploads\\". Why there?

              One other weird thing. One of the attachments I was trying to open is a pdf file. When the app server had security enabled, the pdf wouldn't open. Gave me the 403 security credentials error. Bitmaps opened fine.

              I turned security off at the app server, and the pdf worked fine. Must be a setting somewhere?

              Comment


                #8
                Re: Attachments

                Slim,
                Re upload directory, the client wanted all the uploads in a separate directory, so that's what we did. The D:\A5WAS\Pages is the webroot on his server.

                Re pdf, go to the page security and click on "file types to allow" (or whatever it says) and add pdf to the list of extensions to allow.

                Pat
                Pat Bremkamp
                MindKicks Consulting

                Comment


                  #9
                  Re: Attachments

                  Thank you very much!

                  Comment

                  Working...
                  X