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

Error handling uploads

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

  • Error handling uploads

    I have a lot of error handling in this form (see pic) that works but can't figure out how to give a good error message if the user hits the upload logo button before first choosing a file.

    I've tried this:
    If filetoupload.filename =""
    ? "You must first choose an appropriate file before hitting the Upload Logo button"
    end if

    but I get this result on the page when I test:
    Not found
    filetoupload.filename subelement not found."

    I understand what this message means... Somehow dimming filetoupload.filename first??
    Last edited by EricN; 08-07-2009, 11:33 PM.
    Eric

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

  • #2
    Re: Error handling uploads

    Hi Eric,

    I have got the same problem. I not know how to do this either.

    Gary
    Gary S. Traub, Ph.D.

    Comment


    • #3
      Re: Error handling uploads

      I have this in most of my uploads, and it works.


      if eval_valid("cmd")
      If FileToUpload.filename<>""
      ..my upload code here
      else
      ?"Nothing to upload"
      end if
      end if
      Steve Wood
      Join the ALPHA DEVELOPERS NETWORK
      There is no Cloud. It's just someone else's computer.
      Web - Mobile - Hosting - Products - Frameworks - Developer Resources
      AlphaToGo | IADN (100% Alpha Anywhere Websites)

      Comment


      • #4
        Re: Error handling uploads

        Hi Steve,

        Thanks for that code. It does indeed work. I have been looking for a way to do what Eric was asking for a while ...

        Gary
        Gary S. Traub, Ph.D.

        Comment


        • #5
          Re: Error handling uploads

          Have you run into the 480(I think) second upload limit?

          On a typical internet connection that's about 25 mb - locally it's much bigger..

          So if you are uploading files smaller that 25 mb, it's probably OK - just be aware that the Alpha server currently times out with a response that the page didn't respond.

          I believe that timeout may be setting in the future.
          Al Buchholz
          Bookwood Systems, LTD
          Weekly QReportBuilder Webinars Thursday 1 pm CST

          Occam's Razor - KISS
          Normalize till it hurts - De-normalize till it works.
          Advice offered and questions asked in the spirit of learning how to fish is better than someone giving you a fish.
          When we triage a problem it is much easier to read sample systems than to read a mind.
          "Make it as simple as possible, but not simpler."
          Albert Einstein

          http://www.iadn.com/images/media/iadn_member.png

          Comment


          • #6
            Re: Error handling uploads

            Well guys you are having better luck than I. I tried this before and just did again, below is my result.

            If filetoupload.filename <>""
            Not found
            filetoupload.filename subelement not found."
            Eric

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

            Comment


            • #7
              Re: Error handling uploads

              You need the IF eval_valid("cmd").
              Steve Wood
              Join the ALPHA DEVELOPERS NETWORK
              There is no Cloud. It's just someone else's computer.
              Web - Mobile - Hosting - Products - Frameworks - Developer Resources
              AlphaToGo | IADN (100% Alpha Anywhere Websites)

              Comment


              • #8
                Re: Error handling uploads

                I did and I do...

                This is what I have:
                dim msg as c = ""
                If eval_valid("cmd")
                If filetoupload.filename <>""
                ... more fun stuff ...

                Again, my other error checking works just fine.
                Last edited by EricN; 08-08-2009, 11:30 AM.
                Eric

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

                Comment


                • #9
                  Re: Error handling uploads

                  Maybe it matters how the filetoupload field is created. My example is on an A5W page, no Dialog, just HTML on the page. Here's the whole page (which is a bit complex as a whole, but may be useful for other's designing upload code).


                  HTML Code:
                  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
                  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
                  
                  <%a5
                  'UPLOAD CODE
                  
                  path = "images\logos"
                  dpath = "images/logos"
                  fldr = Request.ApplicationRoot + path
                  dim session.id as c
                  if eval_valid("session.__protected__ulink")
                  	session.id = session.__protected__ulink
                  	else
                  	end 
                  end if
                  
                  'session.mod = mod
                  
                  dim session.im1 as c
                  if eval_valid("cmd")
                  	if file.exists(fldr) = .f.
                  		file.dir_create_recurse(fldr)
                  	end if
                  	IF FileToUpload.filename<>""
                  		filename = fldr + "\\" + FileToUpload.filename
                  		if file.exists(filename)
                  		file.remove(filename)
                  		end if
                  
                  		fileext = file.filename_parse(FileToUpload.filename,"e")
                  
                  		newfilename = fldr + "\\" + session.id + fileext
                  		if file.exists(newfilename)
                  			file.remove(newfilename)
                  		end if
                  
                  		file.from_blob(filename,FileToUpload.data)
                  		file.rename(filename,newfilename)
                  		record_update("[PathAlias.ADB_Path]\developers.dbf","id="+quote(session.id),"logoimageext="+remspecial(fileext))
                  	end if
                  end if
                  %>
                  
                  <html>
                  <head>
                  <meta name="generator" content="Alpha Five HTML Editor Version 9 Build 2095-3264">
                  
                  <%a5 a5w_include("header_head.a5w") %>
                  
                  </head>
                  <body>
                  
                  <div id="wrapper">
                  <%A5 a5w_include("header_body.a5w") %> 
                  <div id="content">
                  
                  <h1>Upload Logo</h1>
                  <p>(best size is 300px width max)</p>
                  
                  <form action=" <%a5 ? request.script_name %> " method="post" enctype="multipart/form-data">
                  <input type="file" size=50 name="FileToUpload" >
                  <input type="submit" name="cmd" value="Upload File">
                  </form>
                  
                  <%a5
                  if eval_valid("cmd")
                  	IF FileToUpload.filename<>""
                  	?"<br><div class=\"adbox\">"
                  	img = fldr + "\\" + session.__protected__ulink + fileext
                  	if file.exists(img)
                  		?dpath + "/" + session.__protected__ulink + fileext+"?r="+time("s3") + "<br>"
                  		imgsrc = dpath + "/" + session.__protected__ulink + fileext+"?r="+time("s3")
                  		?"<img src=\""+imgsrc+"\"></div><br><br>"
                  	end if
                  	else
                  	?"Nothing to upload"
                  	end if
                  end if
                  
                  
                  %>
                  <div class="clearfix"></div>
                  </div><!-- CONTENT -->
                  <%A5 a5w_include("footer_body.a5w") %> 
                  </div><!-- WRAPPER -->
                  </body></html>
                  Steve Wood
                  Join the ALPHA DEVELOPERS NETWORK
                  There is no Cloud. It's just someone else's computer.
                  Web - Mobile - Hosting - Products - Frameworks - Developer Resources
                  AlphaToGo | IADN (100% Alpha Anywhere Websites)

                  Comment


                  • #10
                    Re: Error handling uploads

                    Depending on the client, filetoupload will not be sent, and therefore created by the server, if the field is left blank. You can use eval_valid on filetoupload.filename first.

                    Lenny Forziati
                    Vice President, Internet Products and Technical Services
                    Alpha Software Corporation

                    Comment


                    • #11
                      Re: Error handling uploads

                      I also have code that uses the if eval_valid("cmd")

                      The source code has not changed and was working with v9/v10 a while back but it no longer works with the latest v10 build. No error is reported and file details are posted to the server but the file does not get uploaded.


                      Post Data follows
                      Content-Type: multipart/form-data; boundary=---------------------------24464570528145
                      Content-Length: 427

                      -----------------------------24464570528145
                      Content-Disposition: form-data; name="extraInfo"

                      file upload test
                      -----------------------------24464570528145
                      Content-Disposition: form-data; name="FileToUpload"; filename="test.txt"
                      Content-Type: text/plain

                      test.txt
                      -----------------------------24464570528145
                      Content-Disposition: form-data; name="cmd"

                      Upload Document
                      -----------------------------24464570528145--
                      https://appsbydesign.co.uk/

                      Comment


                      • #12
                        Re: Error handling uploads

                        Hmmm...well thanks Lenny. Thought I tried that before but just tried again and it seems to work.

                        Here is some of my error checking:
                        dim vEnd as c
                        dim vBig as c
                        dim vNoHit as c

                        If eval_valid("cmd")
                        If eval_valid("filetoupload.filename") 'did user hit submit button before choosing a file?
                        If right(filetoupload.filename,3) = "rtf" .or. right(filetoupload.filename,3)= "doc" .or. right(filetoupload.filename,3)= "txt" .or. right(filetoupload.filename,3) = "pdf"

                        dim bb as b
                        bb=FileToUpload.data
                        If bb.size() < 500000 ' checks size limit of image
                        ..... lots of code... :)

                        else
                        dim vBig as c = "ERROR: File must be smaller than 50000 bytes"
                        end if

                        else
                        dim vEnd as c = "ERROR: File must be rtf, pdf, doc, or txt"
                        end if

                        else
                        dim vNoHit as c = "ERROR: You must choose a file before you hit the submit button. <BR> Please try again."
                        end if
                        end if

                        Then just underneath the form, I have:
                        ? "<strong><font color=red size=4><center>"+vEnd+"</center></font></strong>"
                        ? "<strong><font color=red size=4><center>"+vBig+"</center></font></strong>"
                        ? "<strong><font color=red size=4><center>"+vNoHit+"</center></font></strong>"
                        Eric

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

                        Comment


                        • #13
                          Re: Error handling uploads

                          Eric,

                          If you are getting in to lots of error checking and upload validation, you should look into a client-side upload utility. There are free ones. The advantage is they do the checking BEFORE the upload, whereas Alpha alone must upload FIRST then do the checking. By then, if they attempted to upload a 10MB file, its too late.
                          Steve Wood
                          Join the ALPHA DEVELOPERS NETWORK
                          There is no Cloud. It's just someone else's computer.
                          Web - Mobile - Hosting - Products - Frameworks - Developer Resources
                          AlphaToGo | IADN (100% Alpha Anywhere Websites)

                          Comment


                          • #14
                            Re: Error handling uploads

                            Hmmm...

                            As I posted above...I have the following
                            dim bb as b
                            bb=FileToUpload.data
                            If bb.size() < 500000 ' checks size limit of image

                            I've tested using files larger than this threshold and it stops the upload. I will definitely search for and review the free utilities. Any suggestions? :)
                            Eric

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

                            Comment


                            • #15
                              Re: Error handling uploads

                              It should be 'stopping the upload' after the upload is done, although I have not tested this. I guess a test is in order as maybe it reads the filesize as it starts, then aborts. Easy to test.

                              No suggestions, just search. I use a paid one, Aurigma Image Uploader.
                              Steve Wood
                              Join the ALPHA DEVELOPERS NETWORK
                              There is no Cloud. It's just someone else's computer.
                              Web - Mobile - Hosting - Products - Frameworks - Developer Resources
                              AlphaToGo | IADN (100% Alpha Anywhere Websites)

                              Comment

                              Working...
                              X