Search code examples
phpjqueryhtmlfile-uploaduploadify

sends information from the input field along with uploadify


How can I post the value from an input field with the files I uploaded to the server whit UPLOADIFY?

<tr>
    <th>text:</th>
    <td><input type="text" name="userInput" id="userInput" /></td>
</tr>
<tr>
    <th>files:</th>
    <td><input id="file_upload" name="file_upload" type="file" /></td>
</tr>


<script type="text/javascript">
'onUploadStart' : function(){
    $('#file_upload').uploadifySettings(
            'postData', 
            {
                "userInput": $("#userInput").val()
            }
    );
},
</script>

This will working not yet, but how can i do this?


Solution

  • Try:

    
    $(document).ready(function() {
        $('#fileInput').uploadify({
            'uploader'  : 'uploadify.swf',
            'script'    : 'upload.php',
            'cancelImg' : 'cancel.png',
            'auto'      : true,
            'folder'    : '/your_folder_to_upload',
            'onOpen' : function(){
            $('#file_upload').uploadifySettings(
                'scriptData', 
                {'userInput':$("#userInput").val()}
                );
            }
        });
    });
    

    Hope it helps