Results 1 to 2 of 2
Discuss [MobileSafari] my way to see local files on iPhone at the Free Toolchain Software (Cydia App's) - Hackint0sh.org; ...
  1. #1
    Rookie Array cousincocaine's Avatar

    Join Date
    Apr 2007
    Posts
    23
    Post Thanks / Like
    Downloads
    0
    Uploads
    0
    Rep Power
    0

    Post [MobileSafari] my way to see local files on iPhone

    Install Apache and PHP from the installer.

    Activate apache with PHP:
    1. Edit /etc/profile and update the line setting PATH to read as follows:
    Code:
    PATH="/bin:/sbin:/usr/bin:/usr/local/bin:/usr/sbin:/opt/iphone/bin"
    2a. Edit /etc/httpd/httpd.conf and modify "DirectoryIndex":
    Code:
    <IfModule mod_dir.c>
    		DirectoryIndex index.html index.php
    	</IfModule>
    2b. Edit /etc/httpd/httpd.conf and add the following to the end of the file:
    Code:
    ScriptAlias /php /opt/iphone/bin
    	AddType application/x-httpd-php .php
    	Action application/x-httpd-php "/php/php-cgi"
    3. Restart Apache by SSH’ing to the iPhone and running the following command:
    Code:
    apachectl graceful
    Your you build your own iPhone apache/php server.

    You can visit the server on your iphone at: http://127.0.0.1

    REPLACE /Library/WebServer/Documents/index.html with /Library/WebServer/Documents/index.php

    Make sure that this is the content of index.php:
    PHP Code:
    <?php
    //variables
    // ADD FOLDERS HERE TO VIEW HERE
    // DONT FORGET TO SYMLINK THEM! (ln -s fromfolder tofolder)
    $folders = array (
        
    '/Documents/'
        
    );
    // ONLY THERE EXTENSIONS ARE SHOWED
    // DONT FORGET TO ADD YOUR EXTENSIONS HERE!
    $file_types = array(
        
    'mp3',
        
    'aac',
        
    'pdf',
        
    'ppt',
        
    'png',
        
    'txt',
        
    'emlx',
        
    'doc',
        
    'jpg',
     );




    // Returns a human readable size
    function size($fileadres){ 
        
    $size filesize($fileadres);
        
    $i=0;
        
    $iec = array("B""KB""MB""GB""TB""PB""EB""ZB""YB");
        while ((
    $size/1024)>1) {
            
    $size=$size/1024;
            
    $i++;
        }
    return 
    substr($size,0,strpos($size,'.')+2)." ".$iec[$i];
    }
    // vind de bestands extensie van de NAAM
    function file_type($file){ 
        
    $path_chunks explode("/"$file);
        
    $thefile $path_chunks[count($path_chunks) - 1];
        
    $dotpos strrpos($thefile".");
        return 
    strtolower(substr($thefile$dotpos 1));
    }
    //echo files to page
    foreach($folders as $folderadres){
        if (
    is_readable($folderadres)) {
            if (
    $handle opendir($folderadres)) {
                while (
    false     !== (    $file readdir($handle))) {
                
    $extension file_type($file);
                if    (
    $file != '.' && $file != '..' && array_search($extension$file_types)){
                    
    $fileadres $folderadres.$file;
                    
    $folder_content[] = $fileadres ;
                };
            };
        
    closedir($handle); 
        };
        }else{
            
    //given folder can't be read.
        
    };
    };
    $folder_content_count = (count($folder_content));
    echo(
    "<div>");
    echo(
    "<table>");
    echo(
    "<tr><th>Total file count: ".$folder_content_count."\n</th></tr>");
    if(!empty(
    $folder_content)){
        foreach(
    $folder_content as $fileadres){
            
    $file_adres explode("/"$fileadres);
            
    $file_location array_reverse($file_adres);
            
    $file $file_location[0];
            
    $folder $file_location[1];
            echo(
    "<tr>");
            if( 
    $folder != $lastfolder){
            echo(
    "\t<th>");
                echo(
    $folder);
            echo(
    "</th>");
            echo(
    "</tr>");
            echo(
    "<tr>");
            }
            
    $lastfolder $folder;
            echo(
    "\t<td>");
            echo(
    "<a href=\"".$fileadres."\" target=\"_blank\">".$file."</a>");
            echo(
    "</td>");
            echo(
    "\t</tr>\n");
        }
    }
    echo(
    "</table>");
    echo(
    "</div>");
    ?>
    Now you only need to make a 'Documents' folder in your root directory of your iPhone:
    Code:
    mkdir /Documents
    link this directory to the apache webserver directory (This must be done else apache will not give you acces because of the security it provides).
    Code:
    ln -s /Documents /Library/WebServer/Documents/
    Your done! To see your files in /Documents just type: http://127.0.0.1 in mobile safari.

    Questions? Ask them.



  2. #2
    Former Bender
    Guest

    Default

    How about using the Safari file:// patch available on Installer ?

    Also you have been posting several threads without respecting the forum title format policy.
    Please read my signature's link, thanks.

    (thread's renamed and moved to the right section)
    Last edited by Former Bender; 06-17-2008 at 06:01 PM.

 

 

Similar Threads

  1. [MobileSafari] view local file with Beta 3
    By jowo in forum iPhone Developer Exchange
    Replies: 9
    Last Post: 04-22-2008, 07:59 AM
  2. [MobileSafari] Local File Viewer for 1.1.2 ?
    By pdieguez_br in forum Free Toolchain Software (Cydia App's)
    Replies: 1
    Last Post: 04-14-2008, 11:21 AM
  3. Running local HTML files with Safari
    By Pupi in forum General
    Replies: 0
    Last Post: 02-12-2008, 03:41 PM
  4. [MobileSafari] Getting it to *run* .exe files (not download)
    By floffelos in forum Free Toolchain Software (Cydia App's)
    Replies: 3
    Last Post: 01-15-2008, 10:18 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Powered by vBulletin®
Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.
Search Engine Friendly URLs by vBSEO
(c) 2006-2012 Hackint0sh.org
All times are GMT +2. The time now is 11:39 AM.
twitter, follow us!