Using Uploadify, I'm renaming uploaded files via uploadify.php, how do I get the check script to now check for this renamed file??

Posted by Rob Macintosh on Stack Overflow See other posts from Stack Overflow or by Rob Macintosh
Published on 2011-01-17T14:48:33Z Indexed on 2011/01/17 14:53 UTC
Read the original article Hit count: 189

Filed under:
|
|

I've modified my uploadify.php file to rename my uploaded files, i'm appending them with my clients company name.

As you can see i'm using scriptData to set the company name, so that uploadify.php can use it.

documents.php

'scriptData': {
 'PHPSESSID': '<?php echo session_id();?>',
 'client_company': '<?php echo $_SESSION['company'] . "-";?>'
 },

This all works great - but now it breaks my check.php. I'm using the default check script, but now it simply thinks the file doesn't exist, so it overwrites it.

I've tried appending the client_company POST variable to the file check;

check.php

$fileArray = array();
foreach ($_POST as $key => $value) {
 if ($key != 'folder') {
  if (file_exists($_SERVER['DOCUMENT_ROOT'] . $_POST['folder'] . '/' . $_POST['client_company'] . $value)) {
   $fileArray[$key] = $value;
  }
 }
}
echo json_encode($fileArray);

But it doesn't work :( Can anyone help?

© Stack Overflow or respective owner

Related posts about php

Related posts about jQuery