×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Nov 2010
    Posts
    1

    N97 Image downloads using php

    Hi,
    I am working on a wallpaper app enabling user to download wallpapers from my website.
    As Nokia N97 does not provide easy 'download image' option, I want to force download using php.
    I used standard scripts that work in Firefox and IE but they don't work on the mobile device.
    Here is my code:

    <?php
    $fullPath = $_GET['file'];

    if ($fd = fopen ($fullPath, "r")) {
    $fsize = filesize($fullPath);
    $path_parts = pathinfo($fullPath);
    $ext = strtolower($path_parts["extension"]);
    switch ($ext) {
    case "jpeg":
    header("Content-type: image/jpeg");
    header("Content-Disposition: filename=\"".$path_parts["basename"]."\"");
    break;
    case "gif":
    header("Content-type: image/gif");
    header("Content-Disposition: filename=\"".$path_parts["basename"]."\"");
    break;
    default;
    header("Content-type: application/octet-stream");
    header("Content-Disposition: filename=\"".$path_parts["basename"]."\"");
    }
    header("Content-length: $fsize");
    header("Cache-control: private"); //use this to open files directly
    /*
    while(!feof($fd)) {
    $buffer = fread($fd, 2048);
    echo $buffer;
    }*/
    fpassthru($fd);
    }
    fclose ($fd);
    exit;
    ?>

    I know there is a solution, as mobile9.com managed to accoplish this taks, but I don't know how

    Can anyone help me?

  2. #2
    Regular Contributor
    Join Date
    Mar 2006
    Posts
    83

    Re: N97 Image downloads using php

    Hello Anna and welcome to forum

    The following is just working great for me, maybe it could help you too:

    header('Content-type: image/jpeg');
    header('Content-disposition: attachment; filename=Your_wallpaper_name.jpg');
    readfile('http://www.yourdomain.com/Your_wallpaper.jpg');
    exit;

    cheers
    Best regards,
    Dusan

Similar Threads

  1. image using php & sms listener ..............
    By myspaceservices in forum Mobile Java General
    Replies: 3
    Last Post: 2010-03-03, 22:06
  2. N97 Image, Sound
    By mohitrb1 in forum Mobile Java General
    Replies: 12
    Last Post: 2010-02-28, 20:57
  3. Upload Image with POST and catch it with PHP
    By bigbadwolf in forum Symbian Networking & Messaging (Closed)
    Replies: 0
    Last Post: 2007-03-30, 16:08
  4. Upload Image Using PHP
    By suhazim in forum Symbian User Interface
    Replies: 0
    Last Post: 2005-03-26, 01:31
  5. Php Problem: cannot load http://www.aaa.com/op.php 500 server error
    By plmanikandan in forum Browsing and Mark-ups
    Replies: 1
    Last Post: 2004-12-01, 00:45

Posting Permissions

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