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

File Upload Feature pack

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

    File Upload Feature pack

    I have the file upload feature pack.

    The problem is that there is no "upload folder" option in the file upload - user defined action.

    So, I can't specify where I want the file to upload to.

    It seems to automatically go to the webroot, but, though I don't get any errors, the file doesn't actually upload to there.

    The after server event fires just fine, and gives me valid data which I can put into my database.

    So, the two problems are: No Upload folder, and the file doesn't get placed where it should.

    Suggestions?

    #2
    Re: File Upload Feature pack

    BTW, I am using an older version of Alpha5 - 10.5 - 3674. Is that my real problem?

    (Unfortunately, moving forward breaks certain features in my app. I was waiting for V11 to do it all at once. Maybe it's time to bit the bullet!)

    Comment


      #3
      Re: File Upload Feature pack

      OK, I moved up to the latest patch of Alpha 5 (V10). Still no joy - I do not have an upload folder option in my File upload feature pack settings. The option is shown in the online instruction video.

      Comment


        #4
        Re: File Upload Feature pack

        The "file upload - user defined" expects an xbasic function to handle the uploaded files. Why don't you use the "file upload" ?
        Frank

        Tell me and I'll forget; show me and I may remember; involve me and I'll understand

        Comment


          #5
          Re: File Upload Feature pack

          I just figured this out last night. I want to do multiple uploads so I need to use the user-defined.

          I sent a bug message to Selwyn and he straightened me out.

          The training video and the template show different options than are actually available so that threw me off. I think I've got it now.

          Comment


            #6
            Re: File Upload Feature pack

            HI, I have the same problem using this...

            please would you be able to post the solution?

            Thanks

            Miles

            Comment


              #7
              Re: File Upload Feature pack

              From the after_upload function you have access to two variables:

              e.uploadFolder
              e.uploadFolderFullyQualified

              You don't really get to set those variables to anything - they default to the webroot folder.

              You can use them or not.

              You can save the file to wherever you want using the command

              file.From_blob(e.fileArray[i].fileName, e.filearray[i].data)

              With the from_blob command, you can add a directory (whatever directory you want) to the front of the filename and save it there.

              for instance, I have one that looks like this:

              file.From_blob(e.uploadFolderFullyQualified + chr(92) + "trips" + chr(92) + directory + chr(92) + e.fileArray[i].fileName, e.filearray[i].data)

              BTW: the file is saved to the server computer, not to the users computer.

              Does that help?

              Here is a full sample of a working upload_file script:

              function After_Upload as v (e as p)

              status = "File Upload Complete."
              dim cn as SQL::Connection
              directory = convert_type(e.primaryKeyArray[2], "c")
              attachdirectory = convert_type(e.primaryKeyArray[2], "c")
              flagResult=cn.Open("::Name::MYSQLReservations")
              IF flagResult = .f. THEN
              status = "Unable to connect to database"
              ELSE

              for i = 1 to e.filecount

              vcode = "insert into related_files (Trip_ID, Reservation_ID, Full_File_Name) values ("+ e.primaryKeyArray[2] + ", " +e.primaryKeyArray[1]+",'\\" + chr(92) + attachdirectory + "\\" + chr(92) + e.fileArray[i].fileName +"')"


              file.dir_create_recurse(e.uploadFolderFullyQualified + chr(92) + "trips" + chr(92) + directory + chr(92) )

              file.From_blob(e.uploadFolderFullyQualified + chr(92) + "trips" + chr(92) + directory + chr(92) + e.fileArray[i].fileName, e.filearray[i].data)

              flagResult=cn.Execute(vcode)

              IF flagResult = .f. THEN
              status = "Unable to Execute."
              e.abort = .t.
              e.errorText = "Unable to Execute."
              exit for
              END IF

              next i

              END IF

              cn.Close()

              After_Upload = "window.parent.{grid.Object}.refresh(); window.parent.alert('"+status+"');"

              end function

              Comment


                #8
                Re: File Upload Feature pack

                Thankyou Larry

                Ahhhhhhh ok i didn't realise it was the file.from_blob bit did the upload to the server.......

                this is the code I am using, I have the server directory specified in the file.from_blob.......... but it doesn't seem to upload the file to the server anywhere..... nor does it seem to do the refresh at the end...

                can you see anywhere i have it wrong??

                Thanks

                Miles

                function savefiles as v (e as p)
                dim count as n
                count = e.filecount
                dim i as n
                dim arr as p
                arr = e.filearray
                dim cn as sql::connection
                dim cs as c
                cs = e.tmpl.cs.connectionstring
                cn.open(cs)
                dim sql as c
                sql = "insert into files(customer_id, file_name) values (:customerid, :filename)"
                dim args as sql::Arguments
                args.add("customerid",convert_type(e.primarykeyarray[1],"N"))
                'args.add("customerid",2)
                for i = 1 to count
                dim fn as c
                dim data as b
                data = e.filearray[1].data
                fn = "C:\fileman" + chr(92) = e.filearray[i].filename
                file.From_blob(fn,data)
                dim fntostore as c
                fntostore = e.filearray[i].filename

                args.add("filename",fntostore)
                dim flag as l
                flag = cn.execute(sql,args)
                next i
                cn.close()
                e.javascript = "window.parent.(grid.object).refreshlinkedcontent();"

                Comment


                  #9
                  Re: File Upload Feature pack

                  for starters, the equal sign in:

                  fn = "C:\fileman" + chr(92) = e.filearray[i].filename

                  You should run in debug and check the value of fn before you go to file.from_blob. It may also be a problem with the "c:\fileman" part. You may need to do:

                  fn = "C:" + chr(92) + "fileman" + chr(92) + e.filearray[i].filename

                  Make sure the path is correct and that the directory on C exists and that you have permission to write to it.

                  Sometimes the refresh doesn't work like you expect - I think it's a timing issue. Instead of refreshing linked content, try refreshing the entire grid instead.

                  Larry

                  Comment

                  Working...
                  X