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 4019104
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T10:03:52+00:00 2026-05-20T10:03:52+00:00

I have a problem while I need to send data using uploadify script. For

  • 0

I have a problem while I need to send data using uploadify script.

For first time, uploadify script is installed correctly, everything works fine. But I need to use uploaded data (via uploadify script) for mysql and others.

Here is my code for calling uploadify script:

<script type="text/javascript">
$(document).ready(function() {
$('#file_upload').uploadify({
    'uploader' : '/uplod/uploadify/uploadify.swf',
    'script' : '/uplod/uploadify/uploadify.php',
    'cancelImg' : '/uplod/uploadify/cancel.png',
    'folder' : '/uplod/uploads/',
    'auto' : true,
    'multi' : false,
    'onComplete': function(event, queueID, fileObj, response, data){
        var form = document.forms['form'];
        var i = 0;
        var el = document.createElement("input");
            el.type = "hidden";
            el.name = "test";
            el.id = "test2";
            el.value = fileObj.name;
            form.appendChild(el); },
            'onAllComplete': function(event,data) { document.getElementById('form').submit();},
 });
});
</script> 

I found this code at: http://www.uploadify.com/forums/discussion/7102/for-all-those-who-struggle-on-inserting-filenames-into-a-db-after-uploading/p1

It`s about how to callback after file is uploaded.

Here is uploadify.php code:

<?php
   if (!empty($_FILES)) {
   $tempFile = $_FILES['Filedata']['tmp_name'];
   $targetPath = $_SERVER['DOCUMENT_ROOT'] . $_REQUEST['folder'] . '/';
   $targetFile = str_replace('//','/',$targetPath) . $_FILES['Filedata']['name'];
   move_uploaded_file($tempFile,$targetFile);
   echo '0'; // Required to trigger onComplete function on Mac OSX (same for linux and        windows as it seems)

   }
   else { // Required to trigger onComplete function on Mac OSX (same for linux and windows as it seems)
   echo '1';
   $video = $_POST[test];
   $textfield = $_POST[textfield];
   echo $video;
   echo $textfield;
   }
  ?>

And here is form which I need to create how I be able to getting this work.

  <form id="form" name="form" method="post" enctype="multipart/form-data" action="uploadify/uploadify.php">
  <input id="file_upload" name="file_upload" type="file" />
  <input type="text" name="textfield" id="textfield" />
  </form>

Problem is here, when I use enctype="multipart/form-data" uploadify.php writes to me 0, when I delete enctype="multipart/form-data" writes to me 1. And that`s what I need. As you can see from code, I put some stupid code at end of uploadify.php to test it.

I think this don’t work because in javascript code, I don’t write anywhere enctype. maybe I wrong.
I tried editing this:

            var form = document.forms['form'].enctype  = "multipart/form-data"; 

but nothing,

also I tried:

'onAllComplete': function(event,data) { document.getElementById('form').enctype;
document.getElementById('form').submit();},

but again nothing. All help is welcome…

P.S This is test example, for this code I don’t need multipart/form-data but on project which testing, I need multipart/form-data because I`m testing uploadify script for small video uploader, and I need a cover picture for each video.

  • 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-05-20T10:03:53+00:00Added an answer on May 20, 2026 at 10:03 am

    Try:

    var form = document.forms['form'];
        form.enctype  = "multipart/form-data"; 
    

    instead of

    var form = document.forms['form'].enctype  = "multipart/form-data"; 
    

    But as you don’t use multi-uploads, I dont see any need to do this in 2 steps(first send the file, then the complete form).
    See the scriptData-option, it allows you to send both, the file and additional data:

    'scriptData'  : {'textfield':$('#textfield').val()}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem that I believe I need to use grouping using xsl:key
I've been thinking about this problem for a while and have yet to come
I have problem when I try insert some data to Informix TEXT column via
I've just installed VS2008 and have run into a problem that I'm sure can
Basically my problem stems from a desire to have the textbox portion be white,
While trying to use LINQ to SQL I encountered several problems. I have table
I have problem in some JavaScript that I am writing where the Switch statement
I have problem with return statment >.< I want to store all magazine names
I have problem with starting processes in impersonated context in ASP.NET 2.0. I am
I have problem compilin this code..can anyone tell whats wrong with the syntax CREATE

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.