Announcement

Collapse
No announcement yet.

MvCall FILES -- uploading a file with post.

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

    MvCall FILES -- uploading a file with post.

    My file does not seem to get uploaded. Where must FILES reside, in the script or data folder?

    The MvCall command on Mivascript.com does not provode an code example using the FILES parameter.
    See http://www.mivascript.com/item/MvCALL.html

    FILES: Optional, contains variables whose values are filenames that will be uploaded to the URL specified in ACTION. The specified METHOD must
    be 'POST' or 'PUT'.

    Code:
    <MvFUNCTION NAME="Post_Upload" PARAMETERS="url, fieldlist, filepath, response var">
    
        <MIVA MvCALL_Error = "nonfatal, nodisplay">
    
        <MvCAPTURE VARIABLE = "l.response">
            <MvCALL ACTION = "{ l.url }"
                METHOD = "POST"
                FIELDS = "{ l.fieldlist }"
                FILES = "{ l.filepath }"
            >
    
                <MvASSIGN NAME = "l.http_response" VALUE = "{ s.callreturnheader[ 1 ] }">
    
                <MvEVAL EXPR = "{ s.callvalue }">
            </MvCALL>
        </MvCAPTURE>
        <MIVA MvCALL_Error = "fatal, display">
    
        <MvFUNCTIONRETURN VALUE="{ l.http_response }">
    </MvFUNCTION>
    Ray Yates
    "If I have seen further, it is by standing on the shoulders of giants."
    --- Sir Isaac Newton

    #2
    Re: MvCall FILES -- uploading a file with post.

    The code looks OK to me, but of course I can't see the parameters you're passing to this function. From the documentation snippet you included, it looks like the "filepath" variable is supposed to contain, not an actual path, but the name of a variable that contains the path. Also, remember that neither the fieldlist nor the filepath can specify local variables, since those will be outside the scope of this function.

    HTH --
    Last edited by Kent Multer; 06-30-15, 09:40 AM.
    Kent Multer
    Magic Metal Productions
    http://TheMagicM.com
    * Web developer/designer
    * E-commerce and Miva
    * Author, The Official Miva Web Scripting Book -- available on-line:
    http://www.amazon.com/exec/obidos/IS...icmetalproducA

    Comment


      #3
      Re: MvCall FILES -- uploading a file with post.

      I checked with Dev they agreed with Kent's assessment.
      Thanks,

      Rick Wilson
      CEO
      Miva, Inc.
      [email protected]
      https://www.miva.com

      Comment


        #4
        Re: MvCall FILES -- uploading a file with post.

        Originally posted by Kent Multer View Post
        The code looks OK to me, but of course I can't see the parameters you're passing to this function. From the documentation snippet you included, it looks like the "filepath" variable is supposed to contain, not an actual path, but the name of a variable that contains the path. Also, remember that neither the fieldlist nor the filepath can specify local variables, since those will be outside the scope of this function.

        HTH --
        Thanks Kent I changed to
        Code:
        FILES = "l.filepath"
        As to the original question, I did find that FILES is relative to the mivadata folder.
        Last edited by RayYates; 07-01-15, 02:25 PM.
        Ray Yates
        "If I have seen further, it is by standing on the shoulders of giants."
        --- Sir Isaac Newton

        Comment

        Working...
        X