Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: cWebFileUploadButton for wordpress - dataflex 18.2

  1. #1

    Default cWebFileUploadButton for wordpress - dataflex 18.2

    Hi, I'm converting my web application to work with wordpress.

    I came across a problem with the cWebFileUploadButton class.

    When I run wordpress to call the application and try to send a file by clicking the button, I get the error message Received HTTP ERROR '404 Not Found' while uploading file.

    However, if I call the same application by putting the path in the browser, it works perfectly.

    I think this class also has to be ported to wordpress.

    Any suggestions on how to work around the problem until the class is ported.

  2. #2
    Join Date
    Mar 2009
    Location
    Beech Hill - a village near Reading in the UK
    Posts
    2,812

    Default Re: cWebFileUploadButton for wordpress - dataflex 18.2

    Sandro

    I'll have a quick look at it and get back to you - I think we will probably need a cWP version of the class.

    Mike

  3. #3
    Join Date
    Mar 2009
    Location
    Beech Hill - a village near Reading in the UK
    Posts
    2,812

    Default Re: cWebFileUploadButton for wordpress - dataflex 18.2

    Sandro

    Entirely untested, in the interest of getting you a quick fix you can try, put this code into a new class package, cWPFileUploadButton.pkg and use that in you code, then let me know how it goes:

    Code:
    Use cWebFileUploadButton.pkg
    
    Class cWPWebFileUploadButton is a cWebFileUploadButton
        
        Function psUploadUrl Returns String
            String  sURL sHome sHost sPort
            Integer iPos
            
            Forward Get psUploadUrl to sURL
            Move (ServerVariable(ghoWebServiceDispatcher, "SERVER_NAME")) to sHost
            Move (ServerVariable(ghoWebServiceDispatcher, "SERVER_PORT")) to sPort
            Move (ServerVariable(ghoWebServiceDispatcher, "URL")) to sHome
            Move (Pos("WebServiceDispatcher.wso", sHome)) to iPos
            Move (Left(sHome, (iPos - 1))) to sHome
            Move ("//" + sHost + ":" +sPort + sHome + sURL) to sURL
            Function_Return sURL
        End_Function
    
    
    End_Class
    Mike
    Last edited by Mike Peat; 15-Dec-2016 at 05:20 AM. Reason: Return type

  4. #4
    Join Date
    Mar 2009
    Location
    Beech Hill - a village near Reading in the UK
    Posts
    2,812

    Default Re: cWebFileUploadButton for wordpress - dataflex 18.2

    Sandro

    Oops! Just spotted the fact that it should be "Function psUploadUrl Returns String". I have now edited the original, so you can ignore this post if you hadn't grabbed it aleady.

    Mike

  5. #5

    Default Re: cWebFileUploadButton for wordpress - dataflex 18.2

    Hi, Mike.
    I created the class and tested it and got error 405 - method not allowed.

  6. #6
    Join Date
    Mar 2009
    Location
    Beech Hill - a village near Reading in the UK
    Posts
    2,812

    Default Re: cWebFileUploadButton for wordpress - dataflex 18.2

    Sandro

    Oh well, worth a try I suppose. I will have to look into it more fully, which probably won't happen till Monday now.

    I'll get back to you.

    Mike

  7. #7
    Join Date
    Mar 2009
    Location
    Beech Hill - a village near Reading in the UK
    Posts
    2,812

    Default Re: cWebFileUploadButton for wordpress - dataflex 18.2

    Sandro

    OK, this is a bit trickier than I'd thought.  The DF upload mechanism does some clever stuff (I really want to say "spooky stuff", but that would be unprofessional!) which just isn't going to work under WordPress without some modification of the client-side JavaScript (I think).

    Watch this space...

    Mike

  8. #8
    Join Date
    Mar 2009
    Location
    Beech Hill - a village near Reading in the UK
    Posts
    2,812

    Default Re: cWebFileUploadButton for wordpress - dataflex 18.2

    OK Sandro

    I have a nasty kludge-fix that you might like to try in the short term, until we can come up with a nicer solution.

    The issue is that the DataFlex upload mechanism (for the moment) uses an old-style ASP file to actually manage the uploads. This is NOT set in the cFileUploadButton (or one of its ancestors), but is hard-coded as "DFEngine/Upload.asp" into cWebResourceManager.pkg.

    Now when your app is running under WordPress that relative path doesn't work - it needs to be explicitly pointed to it. As a very nasty fix, just for now, try in WebApp.src, somewhere after the line "Use WebResourceManager.wo", add a line something like:

    Code:
    Set psUploadUrl of ghoWebResourceManager to "//DFAppHost/DFAppVirtualDir/DFEngine/Upload.asp"
    or if your app is running on the same machine as the WordPress site, just:

    Code:
    Set psUploadUrl of ghoWebResourceManager to "/DFAppVirtualDir/DFEngine/Upload.asp"
    See if that works.

    Mike

  9. #9
    Join Date
    Mar 2009
    Location
    Beech Hill - a village near Reading in the UK
    Posts
    2,812

    Default Re: cWebFileUploadButton for wordpress - dataflex 18.2

    Sandro

    OK, I think I have a better fix for your problem. Attached is WPWebResourceManager.wo. Download that to your DF4WPLib directory, then change your WebApp.src to "Use WPWebResourceManager.wo" instead of the standard WebResourceManager.wo, recompile and see if it fixes your issue.

    Mike
    Attached Files Attached Files

  10. #10

    Default Re: cWebFileUploadButton for wordpress - dataflex 18.2

    Hi Mike
    Did not work, see error : Received error "Invalid resource string" while uploading file

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •