Announcement

Collapse
No announcement yet.

Vvupload - error

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

  • Vvupload - error

    Hi

    i'm on Valence 4.2
    I'm Trying to do exactly the same as rkanemayer described here .. and that is determining the filename that was uploaded, and adding some timestamp to avoid duplicate names..
    i'm doing exactly the same as is described in his thread.. but when a try to retrieve the localFilename with the vvgetS , i get a blank value , however when i look in the file Valence42t/vvsessvars : it is there.??
    contents from the file.
    content from the VVSESSVARS
    PHP Code:
    VVSESSID:5168CF9...
    VVVARIABLEVVUPLOAD_fileName
    VVVALUE
    :barco.csv 

    in the error-app i noticed that an error was logged :
    PHP Code:
    Program    VVSRVPGM
    Module    VVUTILITY
    Procedure    VVUTILITY_GETSESSVAR
    Message ID    VV00011
    Statement Number    
    Message Text    Session variable 
    "VVUPLOAD_fileName" was not found
    Help Text    
    Valence Login ID    
    *NOSESSION
    IBM i User    TCO
    Timestamp    2015
    -11-27-11.57.28.582000
    Job Number    191999
    Calling Program    EXUPLOAD1
    Call Stack    VVUPLOAD˘VVUPLOAD
    !-->EXUPLOAD1˘EXUPLOAD1!-->VVSRVPGM{VVUTILITY}˘VVUTILITY_GETSESSVAR
    (i've tested with Exupload1
    this is my code
    Code:
          /copy qcpylesrc,vvHspec
         ** --------------------------------------------------------------
         **         Copyright (C) 2008-2014 CNX Corporation
         ** --------------------------------------------------------------
         **     Object ID: EXUPLOAD1
         **       Version: V4.1
         **   Description: Valence Examples
         ** --------------------------------------------------------------
         **--------------------------------------------
         **  d specs
         **--------------------------------------------
         d successMsg      s            256a
         d vvSessID        s             64a
         d localFilename   s           1024a   varying
         d/define includeEMAIL
          /copy qcpylesrc,vvDspec
         **--------------------------------------------
         **  program start
         **--------------------------------------------
          /free
           vvSessId = vvIn_Char('sid');
           vvIn.path = %char(%trim(vvUtility_getValenceSetting('ROOT_PATH'))) +
                       'resources/uploads';
           localFilename= vvUtility_getSessVar('VVUPLOAD_fileName':vvSessId);
           successMsg = 'The file has been successfully uploaded to '+
                        %trim(vvIn.path);
           
           vvIn_file(vvIn:successMsg);
           vvMail.to      = 'myemai....;
           vvMail.subject = 'log from exupload1.pgm';
           vvMail.body    = 'localFilename=' + %trim(localFilename);
           vvMail_Send(vvMail);
           *inlr=*on;
          /end-free
    what i've noticed that the Sessid is blanks, an di don't know why it is.. it is in the post
    Code:
    -----WebKitFormBoundaryQjyBlcpREtKR8kZ5
    Content-Disposition: form-data; name="sid"
    6BA9A22E4455CC165116A85EE0CA6420ECCAA3A5338932DC006CA73CE92F8B96
    ------WebKitFormBoundaryQjyBlcpREtKR8kZ5
    Content-Disposition: form-data; name="app"
    
    115
    ------WebKitFormBoundaryQjyBlcpREtKR8kZ5
    Content-Disposition: form-data; name="pgm"
    
    EXUPLOAD1
    ------WebKitFormBoundaryQjyBlcpREtKR8kZ5
    Content-Disposition: form-data; name="file"; filename="052 (Medium).JPG"
    Content-Type: image/jpeg
    
    ------WebKitFormBoundaryQjyBlcpREtKR8kZ5--

  • #2
    In the case of an upload you cannot use vvIn_char('sid'). Your upload program will automatically be passed the "sid" from vvupload. So in your program, you need to accept the sid parameter (64a) and then use that to pass to vvUtility_getSessVar.

    Comment


    • #3
      Sorry..; your answer is not clear for me .. .. i still don't have a clue how i can pass the sid and extra fields to the rpg program..

      is it possible to give an example...


      (i've modified the exupload1 example panel to contain more fields.. i want those fields to be passed to the rpg program.. )



      thx

      thierry

      Comment


      • #4
        Because the file is uploaded with the variables as a multi-part form the standard vvIn's don't work. VVUPLOAD has a provision to pass the sid as an entry parameter to your EXUPLOAD1 program. So in your program where you have vvIn_char('sid'), take that out and just make sid and entry parameter to the program defined as 64a. Then VVUPLOAD will automatically pass it to EXUPLOAD1.

        Comment


        • #5
          Might also be worth noting that any other variables sent from the front end along with the uploaded file will be saved as session variables, which you can retrive via vvUtility_getSessVar(variableName:sid).

          Comment


          • #6
            Hi all,

            Thx, i've made it work with your help.. life can be simple...

            (it might be worth adding a note in the manuals, or providing an example for this somewhat other way of getting the parms in the rpg-pgm..)


            thx

            thierry

            Comment


            • #7
              Hi Thierry,

              Thanks for the suggestion. We made this topic a blog post and linked to it as our "tip of the month" in this month's Valence Newsletter.

              -Rob

              Comment

              Working...
              X