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

Grid view image upload

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

    Grid view image upload

    I have followed the image upload sample in the help pages and it works fine from an a5w page, but I want to be able to do this from within a detail view.

    My question is this. Where do I place the upload code? In the events section of the grid component? I obviously want this to be uploaded upon pushing the add button when adding a new record, but also when the save button is hit when modifying records.

    I have setup my screenshot field as freeform layout with the following code:
    <input type="file" name="FileToUpload"></input>

    Below is the sample upload code that I want to fire and upload the image referenced in the freeform field control listed above. I am way off here?

    <%a5
    dim msg as c = ""
    if eval_valid("cmd")
    dim fn as C
    fn = "[PathAlias.ADB_Path]\images\\" + FileToUpload.filename
    file.from_blob(fn, FileToUpload.data)
    msg = "<a href=\"/" + FileToUpload.filename + "\" target=\"_blank\">" + FileToUpload.filename + "</a> was uploaded<br /><br />"
    tbl = table.open("[PathAlias.ADB_Path]\ImageDB.dbf")
    tbl.enter_begin()
    tbl.Image = fn
    tbl.Name = FileToUpload.filename
    tbl.Uploaddate = now()
    tbl.enter_end(.t.)
    tbl.close()
    end if
    %>


    Any help would be much appreciated!
    =wake

    #2
    Re: Grid view image upload

    No one? Can this not be done.

    Let me start over and ask the following questions:
    1) Can you upload images from within a detail view grid?
    2) If so can you point me to an example?

    Maybe I rambled on a little to much in my post above.


    Thanks again,
    wake

    Comment


      #3
      Re: Grid view image upload

      I'm in the same boat as the above poster.

      I also need to be able to upload Jpeg files to a table field.

      I hope there's somebody out there that can help us.

      Comment


        #4
        Re: Grid view image upload

        Mike,

        The xbasic goes in the A5W page that holds the component. Place it at the very top, above all tags, inside its own xbasic block.

        After that, there are two items to consider.

        The line if eval_valid("cmd") will need to change. Instead of "cmd", you need to look at the source of the component in the browser and find the Name of the submit button when the Detail view is showing. Use that in place of cmd. It will be longer, like mycomponent_DetailView_Save.

        Next, place the following code just after:

        a5w_run_Component(tmpl_componentname)

        x_componentname.Output.Body.DetailView_HTML = stritran(x_componentname.Output.Body.DetailView_HTML,"method=\"post\"","method=\"post\" enctype=\"multipart/form-data\"")

        Where componentname is YOUR component name.
        Steve Wood
        See my profile on IADN

        Comment


          #5
          Re: Grid view image upload

          Here is a possible alternative. All code is in the .a5w page.
          http://msgboard.alphasoftware.com/al...ad.php?t=74282
          Last edited by EricN; 09-08-2008, 10:57 PM.
          Eric

          Alpha Five Websites
          longlivepuppies.com
          socialservicenetwork.com
          -------------------------------------------------
          socialservicenetwork.org

          Comment


            #6
            Re: Grid view image upload

            Steve,
            Thanks for the reply. One question though.

            When you say:

            Next, place the following code just after:

            a5w_run_Component(tmpl_componentname)

            x_componentname.Output.Body.DetailView_HTML = stritran(x_componentname.Output.Body.DetailView_HTML,"method=\"post\"","method=\"post\" enctype=\"multipart/form-data\"")

            Do you mean just after the xbasic code at the very top of the page? When I try this I get an error as follows.

            Error:Script: /cagsupporttickets/index.a5w line:16
            a5w_run_component(tmpl_Main)
            Variable "tmpl_Main" not found."

            This is most likely because the tmpl_Main variable has not been declared yet.
            That happens further down the page. Does this code go at the bottom of the page?


            Thanks so much!
            Wake

            Comment


              #7
              Re: Grid view image upload

              If it is useful, here is a select-all from an A5W page with an upload on a Grid main view. Note in green where the stritran() code is. This is an upload from main part of the Grid. To make it from the Detail, the stritran() just needs to reference the x_print_order.Output.Body.DetailView_HTML instead.

              Code:
               [COLOR="Red"]<%a5
              
              dim session.id as c
              session.id = "10000" ' TEST VALUE
              if eval_valid("print_order_Button_Submit")
              	IF FileToUpload.filename<>""
              		file.from_blob(FileToUpload.filename,FileToUpload.data)
              	END IF
              dta = "filename=" + FileToUpload.filename
              record_update("[PathAlias.ADB_Path]\print_order.dbf","ID="+quote(session.id),dta)
              
              end if
              
              %>[/COLOR]
              <html>
              <head>
              
              <%a5
              Delete tmpl_print_order
              DIM tmpl_print_order as P
              tmpl_print_order = a5w_load_component("print_order")
              'Following code allows you to override settings in the saved component, and specify the component alias (componentName property).
              'Tip: Keep the componentName property short because this name is used in page URLs, and it will help keep the URLs short.
              'Each component on a page must have a unique alias (componentName property).
              with tmpl_print_order
              	componentName = "print_order"
              end with 
              '=======================================compute the HTML for the Component=======================================
              delete x_print_order
              dim x_print_order as p
              x_print_order = a5w_run_Component(tmpl_print_order)
              '=============================================================================================================
              if x_print_order.RedirectURL <> "" then 
              	response.redirect(x_print_order.redirectURL)
              	end
              end if 
              ?x_print_order.Output.Head.JavaScript
              ?x_print_order.Output.Head.CSS_Link
              
              [COLOR="DarkGreen"]x_print_order.Output.Body.Grid_HTML = stritran(x_print_order.Output.Body.Grid_HTML,"method=\"post\"","method=\"post\" enctype=\"multipart/form-data\"")[/COLOR]%>
              
              <meta name="generator" content="Alpha Five HTML Editor Version 8 Build 1785-3109">
              <title></title>
              </head>
              <body class="SunsetPageBODY">
              <%a5 
              a5w_include("header.a5w")
              %>
              
              <table width="940" border="0" bordercolor="#c0c0c0" cellpadding="10" cellspacing="10" background="" align=center bgColor=#ffffff>
                
                <tr>
                  <td vAlign=top background="" colSpan=2 bgColor=#e8e8e8>
                   <h1>Print Order</h1></td></tr>
              	<tr>
                  <td vAlign=top>
              <table>
              	<tr>
              		<td><%A5 ?x_print_order.Output.Body.Grid_Echo %></td>
              	</tr>
              	<tr>
              		<td><%A5 ?x_print_order.Output.Body.UpdateErrors %></td>
              	</tr>
              	<tr>
              		<td><%A5 ?x_print_order.Output.Body.Search_HTML %></td>
              	</tr>
              	<tr>
              		<td><%A5 ?x_print_order.Output.Body.Grid_HTML %></td>
              	</tr>
              	<tr>
              		<td><%A5 ?x_print_order.Output.Body.DetailView_HTML	%></td>
              	</tr>
              </table>
              </td>
              	</tr>
              </table><%a5 
              a5w_include("footer.a5w")
              %> 
              </body></html>
              Steve Wood
              See my profile on IADN

              Comment

              Working...
              X