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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T07:15:19+00:00 2026-05-24T07:15:19+00:00

I think this will be marked as duplicate but i’m unable to understand my

  • 0

I think this will be marked as duplicate but i’m unable to understand my problem.

I created javascript array using in loop resulting array in console is

["about.png", "about1.png", "about2.png"]

I want to pass this to php so i converted it to json string using JSON.stringify(filenames); I also included json2.js but result is same in console before decoding it..

["about.png","about1.png","about2.png"]

than I decode it $filenames = json_decode($_POST['jsonfilenames']); but file names array is empty. What I’m doing wrong?

I will be able to get javascript array in php as php array that’s what JSON.stringify does?

Update

I’m using uploadify to upload files to get filenames and filepaths I thought of creating array of filenames and filepaths and onAllComplete function pass these array to php scirpt…than will email to user who uploaded the files having filename and filepaths in email….

var filenames = [];
var filepaths = [];

$('#file_upload').uploadify({
  'uploader'  : 'uploadify/uploadify.swf',
  'script'    : 'uploadify/uploadify.php',
  'cancelImg' : 'uploadify/cancel.png',
  'folder'    : 'user_data/<?=$_SESSION['username']?>',
  'auto'      : false,
  'multi'       :true,
  'onComplete' : function(event, queueID, fileObj, response, data) {

     filenames.push(fileObj.name);
     filepaths.push(fileObj.filePath);

  },
  'onAllComplete':function(event,data) {

    console.log(filenames); 

    var jsonfilenames = JSON.stringify(filenames);
    var jsonfilepaths = JSON.stringify(filepaths);
    console.log(jsonfilenames); 

    //ajax stuff    
  },
  //...
});
  • 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-24T07:15:20+00:00Added an answer on May 24, 2026 at 7:15 am

    Your input is probably being corrupted by magic quotes.
    To “solve” this you can use stripslashes(), ie:

    $filenames = json_decode(stripslashes($_POST['jsonfilenames']));
    

    But since magic quotes is a deprecated feature, you should disable it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I think this will be easy but I can't see how to do it!
I think this is specific to IE 6.0 but... In JavaScript I add a
I will preface this question by saying, I do not think it is solvable.
Do you think that C# will support something like ??= operator? Instead of this:
I think this problem is related to this question: Clicking submit clears file field
I think this must be simple but I can't get it right... I have
I created this 2D Qlist. Code works but when I consider a bit deeper
(This is not exactly the problem that I have, but it's isomorphic, and I
I have this thing that i need to do and some advices will be
I'm wondering if this kind of thing will ever be possible in PHP (and

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.