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

Checking And Saving A File In S3

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

    #31
    Re: Checking And Saving A File In S3

    Your issue is probably that you've not set CORS Configuration on your S3 Bucket. Have you set CORS Configuration? You've also not included the console errors you're probably getting.

    Comment


      #32
      Re: Checking And Saving A File In S3

      The code returns name, how do I reference the name so I can do an ajax callback to update a database table with the name?

      Comment


        #33
        Re: Checking And Saving A File In S3

        I think you need to have a look around the area you're in. You've got the File Upload - Amazon S3 dialog open... there are a ton of events and information shown here.

        If you're referring to the code in "Target object name on Amazon S3" - not sure if you are... because you haven't said... then you don't do anything here except name the file.

        There is another event... On Upload Complete... 2 of these actually. You have info available in these events... like e.targetName... so you'd perform an Ajax Callback... sending along this info.

        Comment


          #34
          Re: Checking And Saving A File In S3

          This is the ajax callback code I have in the On Upload Complete {dialog.object}.ajaxCallback('','','updatePetItemFsboUrl','','_petitemName='+e.targetname); then in the XBasic function I have petitemName = e._targetName. It is saying e._targetName subelement not found.

          Comment


            #35
            Re: Checking And Saving A File In S3

            You're passing the value of e._targetName through to the XBasic callback via the variable _petitemName.

            You're looking for the variable e._targetName... when you should be looking for the variable you defined... e._petitemName.

            Comment


              #36
              Re: Checking And Saving A File In S3

              Now the file that is uploaded has undefined in the filename so test.jpg is now test_undefined_jdxpp2qh.jpg. Also the url that is getting written has undefined at the end of the string with no other part of the filename. I guess var ulCnt isnt defined correctly?

              var ulCnt = {dialog.Object}.__S3Cnt;

              var arr = e.name.split('.')
              arr[0] = arr[0] + '_' + ulCnt + '_' + A5.ts();
              var name = arr.join('.');

              {dialog.Object}.__S3Cnt = ulCnt + 1;

              return name;

              Comment


                #37
                Re: Checking And Saving A File In S3

                {dialog.Object}.__S3Cnt was a dialog object namespace variable I established in onRenderComplete... I had something like {dialog.Object}.__S3Cnt = 1;

                But you don't really need it... just use...

                Code:
                arr[0] = arr[0] + '_' + A5.ts();
                as in...

                Code:
                var arr = e.name.split('.')
                arr[0] = arr[0] + '_' + A5.ts();
                var name = arr.join('.');
                
                return name;

                How did you get the file uploaded? Was it CORS?

                Comment


                  #38
                  Re: Checking And Saving A File In S3

                  Yeah it was CORS thought l already set that so thought it was in the code. That fixed the filename but the url is still writing undefined instead any part of the filename. Also I like to understand the code, with arr[0] = arr[0] + '_' + A5.ts(); is this used because of the list control that is being used to get the data? What is A5.ts(); doing?

                  Comment


                    #39
                    Re: Checking And Saving A File In S3

                    A5.ts() is just adding a unique timestamp to the filename.

                    You said you're uploading test.jpg... and that the filename from the Action is being set as test_undefined_jdxpp2qh.jpg. So... the test part is ok... and the jpg part is ok. The undefined part was because of that namespace variable... now gone. So now, the e._targetName should be something like test_jdxpp2qh.jpg.

                    When did the List control come into play?

                    arr is an array resulting from splitting the e.name var into 2 pieces based on the filename period (.). arr[0] is the filename part of the file. arr[1] would be the filetype part of the file. The code is splitting up the value of e.name, changing the filename part - adding a timestamp, and then putting the filename back together with the filetype.

                    Good to know it was the CORS Configuration causing the XHR error.
                    Last edited by Davidk; 02-21-2018, 08:39 PM.

                    Comment


                      #40
                      Re: Checking And Saving A File In S3

                      I have this in Upload Complete for Ajax callback: {dialog.object}.ajaxCallback('','','updatePetItemFsboUrl','','_petitemName='+e.targetname); Then below is the XBasic function:

                      function updatePetItemFsboUrl as v (e as p)
                      '-- used if cant get checked existing filename working

                      dim globalcn as sql::connection
                      dim sql as c
                      dim args as sql::arguments
                      dim flag as l
                      dim petitemName as c



                      flag = globalcn.open("::name::petvv")
                      args.set("petitemid", e.dataSubmitted.itemid)

                      petitemName = e._petitemName
                      petitemName = "https://s3.amazonaws.com/pvvpetitemsfsbo/" + petitemName


                      sql = "UPDATE pvv_items_for_sale SET IMAGE = '" + petitemName + "' where ITEMID = :PETITEMID"
                      flag = globalcn.execute(sql,args)


                      This is the url it is writing to the IMAGE field, https://s3.amazonaws.com/pvvpetitemsfsbo/undefined so why isnt petitemName getting set to e.targetName which is e._petitemName?

                      Comment


                        #41
                        Re: Checking And Saving A File In S3

                        You're using e.targetname in the callback... it needs to be e.targetName - in Javascript, case matters.

                        Comment


                          #42
                          Re: Checking And Saving A File In S3

                          Details.. Details.. :) Thanks for your help!!!!!!!!!!

                          Comment

                          Working...
                          X