Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jan 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    PHP Download Image don't appear

    I have been figuring out why the downloaded image will not appear. Here's it:

    require_once('include/middletier/waitlist_form.class.php');
    $tbleswaitlist = new waitlist_form();
    $tbleswaitlist->display_upg($_REQUEST['studentNum']);

    $cpath="C:xampp/htdocs/OCWMS/modules/waitlist/uploads/".$tbleswaitlist->name;
    header("Pragma: public");
    header("Expires: 0");
    header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
    header("Cache-Control: private",false);
    header("Content-type: ".$tbleswaitlist->fileType);

    header("Content-Disposition: attachment; filename=\"".basename($tbleswaitlist->name)."\"" );
    header("Content-Length: ". $tbleswaitlist->fileSize);
    ob_clean();
    flush();
    readfile($cpath);
    exit();

    Please help me out guyz...

  • #2
    Regular Coder
    Join Date
    Jan 2012
    Posts
    271
    Thanks
    2
    Thanked 65 Times in 65 Posts
    print or echo
    PHP Code:
    $tbleswaitlist->name 
    and see if you are in fact getting the right file and if it exists

    or add
    PHP Code:
    if(file_exists($cpath)){
         
    readfile($cpath);
    }else{
         echo 
    'oops... no file there';



  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •