Jump to content

Recommended Posts

Hi! There's this code which I have
 

function pushfile(&$file) {
    header_remove();
  if (isset($file["type"])) header('Content-Type: '.$file["type"]);
  if (isset($file["name"])) header('Content-Disposition: attachment; filename="'.$file["name"].'"');
  print $file["name"];
  header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
  header("Pragma: ");
  echo $file["content"];
  exit;

$h=fopen($filename,"r");
        $content = fread($h, filesize($filename));
        fclose($h);
        $file["type"] = "application/";  //
        $file["name"] = $real_filename;
        $file["content"] = $content."*".$context['user']['id'];
        pushfile($file);

This ID number was well placed into the downloaded file, but it disappeared after converting it (e.g. from pdf to epub). Is there a good solution for that?

4 hours ago, mikcsu120 said:
$file["content"] = $content."*".$context['user']['id'];

Your adding the ID to the content of the file right there.  If you don't want the ID number in the file, then don't add it.

$file['content']=$content;

 

15 hours ago, mikcsu120 said:

How to put it in the middle of the content?

Probably not what you really want, but it is what you asked for:

$midPt = floor(strlen($content)/2);

$file["content"] =  substr($content, 0, $midPt) . $context['user']['id'] . substr($content, $midPt);

 

  • Like 2
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.