access document.getElementById(' in php

330 Views Asked by At

I am trying to access an element in php for document.getElementById( the element is file.name and the id is 'filelist' but the php does not accept the code for the line shown below, can someone advise on the correct syntax as everything I have tried returns null

$data = "document.getElementById("filelist").innerHTML += '<br/>' + file.name";
1

There are 1 best solutions below

0
mark.four On

Diego De Vita, that guy that you commented, was 'very very far from anything meaningful' in a galaxy far, far away, happened to fix the issue, never underestimate the crazies of this world, here is the fix.

In plupload there is a main upload script called upload.php and this is the code that renames the uploaded file to a meaningless code i. e. file_6272e003ad256 and this is the code in upload.php that renames that file id name

// Check if file has been uploaded
if (!$chunks || $chunk == $chunks - 1) {
    // Strip the temp .part suffix off 
    rename("{$filePath}.part", $filePath);

So, search this file for the word filename

    // What to look for
$search = 'filename';
// Read from file
$lines = file('file_6272e003ad256');
foreach($lines as $line)
{
  // Check if the line contains the string we're looking for, and print if it does
  if(strpos($line, $search) !== false)
    echo $line;
}

Then extract the phrase between the double quotes and this is the filename to rename the file with

rename($filePath, $original_filename);