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 to Document Catalog & Server

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

    Upload File to Document Catalog & Server

    Hi Everyone,

    Can anyone tell me how to get my file upload to my document catalog working?

    I have created a dialog grid that populates my document catalog table. I want clients to be able to add their document to the catalog including uploading the file to the server. They should be able to go to the document catalog, be able to search for and view the general information entered at the time the document was added. This part is not the problem. I have this working.

    I have also been able to get files to upload using code found in the Alpha help section.

    How though do I associate the uploaded file to the entry in the document catalog? Is there a way to upload it along with my dialog and have the filename and path stored in a field in my document catalog table?

    The controls on my dialog component are:

    Dc_Id - C 8
    Fac_Id - C 8
    Dc_Type - 30 C
    Dc_Name - C 75
    Dc_Desc - C 250
    Dc_Keywords - C250
    Dc_Date - D 10
    Dc_File - C 125 (This is where I would like the filename and path)
    Dc_Author - C 125

    #2
    NEED HELP - Upload File to Document Catalog & Server

    BUMP

    I have tried seamingly everything at this point. Here is a summary:

    I have a dialog component named fileupload with the following fields:

    vDc_type
    vDc_title
    vDc_desc
    vDc_keywords
    vDc_date
    vDc_author
    vDc_file

    A have a entered the following code in the vDc_file freeform layout:

    <input type="file" name="FileToUpload" >

    I have the following code in my AfterValidate:

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

    else
    vDc_file="[PathAlias.ADB_Path]\Documents\\"+FileToUpload.filename
    file.From_blob(vDC_file, FileToUpload.data)
    end if

    tbl=table.open("[PathAlias.ADB_Path]\doc_cat.dbf")
    tbl.enter_begin()
    tbl.Dc_type=(CurrentForm.Controls.vDc_type.value)
    tbl.Dc_name=(CurrentForm.Controld.vDc_file.value)
    tbl.Dc_desc=(CurrentForm.Controls.vDc_desc.value)
    tbl.Dc_keywords=(CurrentForm.Controls.vDc_keywords.value)

    tbl.enter_end(.t.)
    tbl.close()

    The fileupload dialog component has been added to an a5w page named fileupload.a5w. Here is the source:

    <html>
    <head>

    <%a5
    Delete tmpl_fileupload
    DIM tmpl_fileupload as P
    tmpl_fileupload = a5w_load_component("fileupload")
    '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_fileupload
    componentName = "fileupload"
    end with
    '=======================================compute the HTML for the Component=======================================
    delete x_fileupload
    dim x_fileupload as p
    x_fileupload = a5w_run_Component(tmpl_fileupload)
    '=============================================================================================================
    if x_fileupload.RedirectURL <> "" then
    response.redirect(x_fileupload.redirectURL)
    end
    end if
    ?x_fileupload.Output.Head.JavaScript
    ?x_fileupload.Output.Head.CSS_Link
    %>
    <%A5 ?x_fileupload.Output.Body.Dialog_HTML = stritran(x_fileupload.Output.Body.Dialog_HTML,"method=\"post\"","method=\"post\" enctype=\"multipart/form-data\"")
    %>
    <!--Alpha Five Temporary Code Start - Will be automatically removed when page is published -->
    <!--CSS for tmpl_fileupload -->
    <link rel="stylesheet" type="text/css" href="file:///C:/Program Files/a5v9/css/Modern/style.css">
    <!--Alpha Five Temporary Code End -->

    <meta name="generator" content="Alpha Five HTML Editor Version 9 Build 1888-3221">
    <title></title>
    </head>
    <body>
    <p><br>
    <table>
    <tr>
    <td><%A5 ?x_fileupload.Output.Body.Dialog_Echo %></td>
    </tr>
    <tr>
    <td><%A5 ?x_fileupload.Output.Body.Xbasic_Code_Errors %></td>
    </tr>
    <tr>
    <td><%A5 ?x_fileupload.Output.Body.Dialog_HTML %></td>
    </tr>
    </table></p>
    </body></html>

    I am getting the following error message and needless to say nothing is being uploaded or added to my document catalog table.

    ERROR MESSAGE:

    False

    Errors in: event.AfterValidate code:
    Not found
    FileToUpload.filename subelement not found.

    Comment


      #3
      Re: Upload File to Document Catalog &amp; Server

      Robert

      While I have not done this myself yet - I have seen many posts on the board about this subject. I think if you do an advanced search for just the App Server V9 section of the board on the words "upload file" you will get quite a few hits.

      Also, Pat Bremkamp made this post recently that is pretty complete. It pertains to photos but I am pretty sure uploading documents correlates nicely.

      Regards,

      Jeff

      Comment


        #4
        Re: Upload File to Document Catalog &amp; Server

        Robert,

        Instead of putting the path and filename in the table, I suggest you prefix the document name with the doc_id. Otherwise, if you let clients upload their own documents, you will get three different people trying to upload "document1".

        Then load all the docs into, for example, A5webroot/docs, and the first three documents will be named (assuming a doc id of "D00001" autoincrementing)

        D00001.mydoc.pdf
        D00002.mydoc.pdf
        D00003.document1.doc

        and so on.

        To retrieve them, just look for the doc id. You don't need to know the rest.

        Pat
        Pat Bremkamp
        MindKicks Consulting

        Comment


          #5
          Re: Upload File to Document Catalog &amp; Server

          Thanks Pat and Jeff,

          I will at the Doc ID to the file name. Also, I have completed an exhaustive review of EVERY post relating to file upload. I can't seem to figure it out.

          Pat...do you have any suggestions?

          Thanks.

          Comment


            #6
            Re: Upload File to Document Catalog &amp; Server

            Robert,

            Try putting the code in the page rather than in a dialog. Here's page source from one of my applications. The page is shown in the attachment.
            The dialog component is just a multiselect dropdown populated with filefind.get() to show the uploaded documents.

            Code:
             
            <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[URL]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd[/URL]">
            <html xmlns="[URL]http://www.w3.org/1999/xhtml[/URL]" xml:lang="en" lang="en"><head>
            <%a5
            '==== 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 session.Message as C = "Upload Supporting Documents"
            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
            session.Message = "Please use the Browse button to navigate to the file before uploading."
            else
            session.Message = "<a href=\"/" + FileToUpload.filename + "\" target=\"_blank\">" + FileToUpload.filename + "</a> was uploaded."
            '==== record that this CAR has attachments
            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
            end if
            %>
            <%a5
            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
            %>
            <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
            <meta name="generator" content="Alpha Five HTML Editor Version 8 Build 1173-3034" />
            <title>CAR Attachments</title>
            <link href="css/calmax/pagestyle.css" rel="stylesheet" type="text/css" />
            </head>
            <body class="CalMaxPageBODY">
            <p class="closer"><a href="javascript:window.close();">Close Window</a></p>
            <h3><%a5 ?session.Message %></h3>
            <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>
            <p><%A5 ?x_CAR_Attach.Output.Body.Xbasic_Code_Errors %></p>
            <p><%A5 ?x_CAR_Attach.Output.Body.Dialog_HTML %></p>
            <p>The selected attachment is <%a5 ?session.SelectedFile %></p>
            <p><a href="<%a5 ?session.SelectedFile %>" target="_blank">&nbsp;Open the selected attachment</a></p>
            <p><a href="Attach_Delete.a5w?vFrom=CAR">&nbsp;Delete the selected attachment</a></p>
            </body></html>
            Pat
            Pat Bremkamp
            MindKicks Consulting

            Comment


              #7
              Re: Upload File to Document Catalog &amp; Server

              Thanks Pat. I will give this a try.

              Comment

              Working...
              X