Search code examples
phpjavascriptuploadify

Storing form data in a javascript session


I was wondering if it's possible to store form data such as 'title' and 'description' in a javascript session?

I'm using the uploadify script to have a flash uploader, but the script isn't passing the title and description. This is my code at the moment;

<script type="text/javascript">

    jQuery(document).ready(function() {
        title = $("input#title").val();
        description = $("textarea#description").val();

        $('#uploadImage').uploadify({
            'uploader': 'flash/uploadify.swf',
            'script': 'process/process_uploaded_image.php',
            'folder': 'submitted/pictures',
            'cancelImg': 'images/cancel.png',
            'queueID'        : 'fileQueueImages',
            'auto'           : false,
            'multi'          : false,
            'fileExt' : '*.jpg;*.png;*.gif;*.jpeg;*.JPG',
            'fileDesc': 'Images ONLY (.jpg, .png, .gif, .jpeg, .JPG)',
            'buttonText' : 'BROWSE',
            'scriptData': {'title':title,'description':description,'user':'<?php echo $usr["id"] ?>'},
            'sizeLimit' : '2097152', //2MB
            //'buttonImg' : '/components/com_mm/assets/images/button-upload-images.png',
            //'width' : '218',
            //'height' : '66',
            onAllComplete: function() {
              //$('#uploadedImage').load(location.href+" #uploadedImages>*","");
              //location.reload(); //uncomment this line if youw ant to refresh the whole page instead of just the #allfiles div
                 location.href = "upload-pics-thanks.php";
            },
            //onComplete: function(a, b, c, d, e){
            //     if (d !== '1')
            //           alert(d);
            //},
            onError: function (a, b, c, d) {
                alert("Error: "+d.type+"      Info: "+d.info);
            },
            onSelect: function () {

            }   
        });
    });
</script>

Solution

  • Check out this SO answer and in case that doesn't work...

    Did you see this post in the Uploadify forums? Maybe it'll point you in the right direction, and wow so much spam in those forums.

    http://www.uploadify.com/forum/viewtopic.php?f=7&t=3120