Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8558419
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T15:48:26+00:00 2026-06-11T15:48:26+00:00

I have multiple input fields on one page. Each input field have a text

  • 0

I have multiple input fields on one page. Each input field have a text input and a file upload field. The current workflow looks like the following:

  • Directly after the upload the name of the files is stored in the
    database. (uploadify.php)
  • I get an ID from the database which I need to correspond
    to the upload field. (uploadify.php – write in session?)

Now I need a way to keep track of which file upload corresponds to which text input. If I have the id of the file upload field, I can make a relation to the corresponding text input and together with the returned id from the database I could store the text to the corresponding upload.

I tried the way described here, but onSelect only has a file object which can’t provide me the data which input field called Uploadify. I didn’t found another function which provide me this in the actual version of Uploadify.

Now I’m thinking about using $_SESSION for this, but don’t know how this can be done.

Client side:

$('.iconupload').uploadify({
    'swf'            : '<?php echo SUBFOLDER; ?>/swf/uploadify.swf',
    'uploader'       : '<?php echo SUBFOLDER; ?>/includes/uploadify.php',
    'formData'       : {'folder' : '<?php echo IMG_UPLOAD_ICONS; ?>', 'id' : '<?php echo $_SESSION['ID']; ?>', 'type' : 'icon'},
    'multi'          : false,
    'auto'           : true,
    'removeCompleted': false,
    'queueSizeLimit' : 1,
    'simUploadLimit' : 1,
    'fileTypeExts'       : '*.jpg; *.jpeg; *.png; *.gif',
    'fileTypeDesc'       : 'JPG Image Files (*.jpg); JPEG Image Files (*.jpeg); PNG Image Files (*.png), GIF (*.gif)',
    'onUploadError'  : function(file, errorCode, errorMsg, errorString) {
        alert('The file ' + file.name + ' could not be uploaded: ' + errorString);
    },
    'onUploadSuccess': function(file, data, response) {
        //alert('The file ' + file.name + ' was successfully uploaded with a response of ' + response + ':' + data);
    },
    'onSelect'       : function(file) {
        //var elem_id = $(event.target).attr("id"); //here you get the id of the object.
        //alert (elem_id);
        console.debug(file);
        //$("#"+elem_id).uploadifySettings('formData',{'formID':elem_id})
    }
});

Server-side:

if (!empty($_FILES)) {
    $tempFile = $_FILES['Filedata']['tmp_name'];
    $targetPath = $_SERVER['DOCUMENT_ROOT'] . $_REQUEST['folder'] . '/';
    $targetFile = rtrim($targetPath,'/') . '/' . $_FILES['Filedata']['name'];

        $res= mkdir(str_replace('//','/',$targetPath), 0750, true);
        $res2=move_uploaded_file($tempFile,$targetFile);
        $relative_url = str_replace($_SERVER['DOCUMENT_ROOT'],'',$targetFile);
        echo $relative_url;


    if($_REQUEST['type'] == 'icon' && !empty($_REQUEST['id'])){
        $iconid = $db->addIcon($_REQUEST['id'], $relative_url);
        $icons = array();
        if(isset($_SESSION['icons'])){
            $icons = $_SESSION['icons'];
        }
        $icons[$_REQUEST['formID']]= $iconid;
        $_SESSION['icons'] = $icons;
    }
}

Perhaps one could use onUploadSuccess and the data object, which can be returned in uploadify.php and use some Javascript magic. But I still don’t know from which input field Uploadify was called …

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T15:48:27+00:00Added an answer on June 11, 2026 at 3:48 pm

    You can setup uploadify using jQuery .each(). This will allow you to set an id to be passed through the formData like this:

    $('.iconupload').each(function() {
        var $iconUpload = $(this);
    
        $iconUpload.uploadify({
            'swf'            : '<?php echo SUBFOLDER; ?>/swf/uploadify.swf',
            'uploader'       : '<?php echo SUBFOLDER; ?>/includes/uploadify.php',
            'formData'       : {'folder' : '<?php echo IMG_UPLOAD_ICONS; ?>', 'id' : '<?php echo $_SESSION['ID']; ?>', 'type' : 'icon', 'uploadId': $iconUpload.attr("id")},
            'multi'          : false,
            'auto'           : true,
            'removeCompleted': false,
            'queueSizeLimit' : 1,
            'simUploadLimit' : 1,
            'fileTypeExts'       : '*.jpg; *.jpeg; *.png; *.gif',
            'fileTypeDesc'       : 'JPG Image Files (*.jpg); JPEG Image Files (*.jpeg); PNG Image Files (*.png), GIF (*.gif)',
            'onUploadError'  : function(file, errorCode, errorMsg, errorString) {
                 alert('The file ' + file.name + ' could not be uploaded: ' + errorString);
            },
            'onUploadSuccess': function(file, data, response) {
                //alert('The file ' + file.name + ' was successfully uploaded with a response of ' + response + ':' + data);
            }
        }
    });
    

    If you do not want to save the data within uploadify.php, you can save it in onUploadSuccess like this:

    'onUploadSuccess': function(file, data, response) {
        saveIconData($(iconUpload.attr("id"), file.name);       
    }
    
    function saveIconData(id, fileName) {
        // Save via ajax
    }
    

    To save data via ajax, you can use jQuery’s $.ajax() method. You would setup the ajax call something like this:

    $.ajax({
        url: "urlToPhpFile.php",
        data: { iconID: value, iconFileName: value },
        success: function(result) {
            // do something on success of save
        }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have multiple input fields on my page. I Regex them with a css
I have multiple input text fields grouped in divs: <div class=container0> <input class=containerItem0 name=containerItem[0][0]
I have multiple input textboxes in my page. I want to reset particular text
I have multiple input fields. <input type='text' size='10' name='firstname' id='firstname' /> <input type='text' size='20'
I have a form with multiple input fields, but only want to use one
Have a page where there are multiple input fields of the same thing, Posts.
Have a page where there are multiple input fields of the same thing, Posts.
I have a form with 5 input fields. Each field has an array name,
I have form with multiple input type=radio with text next to them. I want
I have an HTML form that needs multiple submit buttons, like this: <input type=submit

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.