Skip to main content

How do I upload files using http/ftp to iphone/ipad? (Eg. ifile, goodreader)


Is there any good advice on uploading files to the device? I've seen many apps create a http server on 80 or 8080 to upload files. Does that mean I have to implement a server too?



Are there any 3rd-party libraries? (Preferably open-source and non-GPL)



EDIT: I am going to upgrade files in the app for specific devices in a corporate environment, so the ipad pulling files from a central server is also an alternative. But I would have to send messages to these ipads to tell them to fetch those files.


Source: Tips4all
Source: Tips4allSource: CCNA FINAL EXAM

Comments

  1. I assume what you want is a kind of automatic update. An app do something by order from server without user's manual operation.

    I don't know enterprise-license specific feature of iOS. But I believe there's no such enterprise-specific APIs. And as I know, automatic update is almost impossible. Because,


    There is no system-level support for automatic update. (yet?)
    So messaging and fetching feature should be implemented in app.
    But no app is guaranteed to run in background for long time.
    And also user can turn off any app at any time.
    There is no way to send message to an app which is not running.
    Even you can send, there is no way to address each client form the server.


    If your app is running, sending message or commanding them to fetch or do anything is just a simple work. The problem is there is no regular way to force them always keep alive. Even under situations like OS reboot or abnormal termination.

    However there is an alternative. Just registering app as VOIP app like Skype. OS does not keep the app running too, but will monitor specific socket port, and will wake your app when the socket receives some message. For more details, see here: http://developer.apple.com/library/ios/documentation/iphone/conceptual/iphoneosprogrammingguide/BackgroundExecution/BackgroundExecution.html#//apple_ref/doc/uid/TP40007072-CH5-SW15

    In AppStore, an app using VOIP for other purpose like automatic update will not be passed, but you have no need to concern about it.

    And other way to send message to device without running app is push notification. This is a feature supported in system-level. But this is not designed to commanding app. This is designed to send textual message. So If your app is not running, the message will be displayed to user. However, you can guide the user to start the app by sending push notification.

    As a final option, you can request some feature to Apple for enterprise environment. If your company is big enough to get an enterprise license, Apple will consider your feature request seriously.



    If you decided to use VOIP method, I'm sorry I can't help you any more. I have no experience of implementing this kind of app. But it should not so hard.

    However hard part is server. It definitely require custom server program which keeps TCP/IP connection. Regular HTTP server cannot be used. Because HTTP itself is designed as not to keep TCP/IP connection. You have to build this kind of server yourself from scratch. You'll have to handle lower level TCP/IP transmissions.

    There are a few solutions(both of free/commercial) for this kind of server, but none of are popular because this kind of server regularly needs full customization. So there's nothing to re-use or share.

    However I believe this is most suitable implementation for your app.



    If you can satisfy automatic update only when the app is running, you can archive it by polling server status from the client periodically.

    This is easy to implement because you can use regular HTTP servers for this. Client connect and download recent updates from central server periodically. If there is a new update, just fetch and do what you want. And the app is launched, just check the update at first. Prevent all operation until update applied.

    This is regular way. Most of applications are built with this method. In this case, you have no need to implement server or hard thing.

    However applying speed of update is depend on polling period.



    (Edit)

    I couldn't care about private APIs. Because your app is not for AppStore, so you can use private API's freely. (This is different thing with jail-breaking. There are so many hidden features by excluded from documentation) I don't know about private APIs, but it's possible there is some API which enable the support for keep-alive of the app.
    However, this reverse engineering work is so painful unless you're born to hack.

    ReplyDelete
  2. But I would have to send messages to
    these ipads to tell them to fetch
    those files.


    Push Notification Programming Guide

    Or mail with custom URL scheme for launching your application.

    iOS Application Programming Guide - Implementing Custom URL Schemes

    ReplyDelete
  3. You may try to use the following open-source in your project:

    http://code.google.com/p/cocoahttpserver/

    https://github.com/robin/cocoa-web-resource/wiki

    ReplyDelete
  4. So you have a couple options:


    You could distribute your app wirelessly within your organization and push new content out as app updates. Apple provides this option to their Enterprise Developers.


    Wireless App Distribution

    iPhone enables enterprises to securely host and wirelessly distribute in-house apps to employees over Wi-Fi and 3G. Apps can be updated without requiring users to connect to their computers. In-house apps can be hosted on any web server accessible to users. Users simply tap on a URL to install apps wirelessly without needing to connect to their computers.

    The alternative is you configure the app to fetch the updated data. You describe adding an HTTP server to the iOS device, but there's no way the server can receive data when the app isn't running. Given your needs, it would probably work better to embed a web client in your app instead.

    If I was in your shoes (and option #1 didn't work), I'd use ASIHTTPRequest to check with a server at launch/daily. If there are new updates, the app could then either prompt the user that there are new data files to download, or it could just silently download them in a background thread.

    UPDATED: Perhaps I should have been more explicit about how to do #2. You can configure the download so it isn't interrupted when the user quits the app (you don't need to do a Voip hack). Check out the Completing a Finite Length Task in the Background section in the iOS Programming Guide.

    ReplyDelete
  5. There are http server sample codes from Apple and open source community such as cocoahttpserver TouchHTTPD.
    You can upload file to the http server on iphone.

    Here's a blog and screen-shots about running cocoahttpserver and upload file to iphone.

    ReplyDelete
  6. See my post here. I explain how to upload using PHP.

    ReplyDelete
  7. The Python CGIHTTPServer allows you to create a server in 0 lines of code:


    jcomeau@intrepid:~/rentacoder/bin2txt$ python -m CGIHTTPServer
    Serving HTTP on 0.0.0.0 port 8000 ...


    Actually implementing a script to parse the input and save the file would take a little more effort.

    [later]
    OK, so forget about that, Apple doesn't allow it. See Local server on iPad for the iPad at least.

    ReplyDelete

Post a Comment

Popular posts from this blog

[韓日関係] 首相含む大幅な内閣改造の可能性…早ければ来月10日ごろ=韓国

div not scrolling properly with slimScroll plugin

I am using the slimScroll plugin for jQuery by Piotr Rochala Which is a great plugin for nice scrollbars on most browsers but I am stuck because I am using it for a chat box and whenever the user appends new text to the boxit does scroll using the .scrollTop() method however the plugin's scrollbar doesnt scroll with it and when the user wants to look though the chat history it will start scrolling from near the top. I have made a quick demo of my situation http://jsfiddle.net/DY9CT/2/ Does anyone know how to solve this problem?

Why does this javascript based printing cause Safari to refresh the page?

The page I am working on has a javascript function executed to print parts of the page. For some reason, printing in Safari, causes the window to somehow update. I say somehow, because it does not really refresh as in reload the page, but rather it starts the "rendering" of the page from start, i.e. scroll to top, flash animations start from 0, and so forth. The effect is reproduced by this fiddle: http://jsfiddle.net/fYmnB/ Clicking the print button and finishing or cancelling a print in Safari causes the screen to "go white" for a sec, which in my real website manifests itself as something "like" a reload. While running print button with, let's say, Firefox, just opens and closes the print dialogue without affecting the fiddle page in any way. Is there something with my way of calling the browsers print method that causes this, or how can it be explained - and preferably, avoided? P.S.: On my real site the same occurs with Chrome. In the ex