want to know the exact size of a data contend in any specified url - iphone

hi all i want to know that while specifying url in my iphone native application for downloading purpose it works fine but if i want to know the exact size of data either in kb or in Mb coming from that url how could i do that plz guide me to do that demonstarting a sample code would be a big boost
thanks

ASIHTTPRequest can request the size of the download for the purposes of attaching a download progress indicator.

Related

Uploading images from iPad in base64 format and size limit

We are developing a inspection application for iPad, where user can select multiple images from iPad and upload this images to portal, also he can enter comments on each particular image.
We are using xml for communication and converting images into base64 string format and uploading to server.
When xml size reaches around 2 MB, at the server side xml is not received and tomcat server returns Null Pointer Exception.
It will work fine if xml size is less than 2 MB.
So i would like to know is converting images to base64 is a proper way to upload images to server?
Is there any size limit for uploading data from iPad/iPhone Application?
Any help is really appreciated.
hi just compress your image
NSData *imageData = UIImageJPEGRepresentation(theImage, 0.1f);
This compress your image and then convert it to base64..
Use ASIHTTP framework for uploas an image from mobile to server
use the below link for how to upload image
http://allseeing-i.com/ASIHTTPRequest/How-to-use don't forgot to add asihttp framewok to your app
We have used PUT for HTTPMethod instead of POST and it worked properly, But I am not sure if there are any disadvantage of using PUT.

iPhone: Efficiently downloading images from a URL into iPhone App

In my iPhone app , I need to display the images from server.
I need to download it and save it from URLs.
There are roughly 20 images which I need to download.
What could be a way out where in performance doesnt decrease?
I have tried previously using NSData to convert the images into NSData and saving it to my app but it takes lots of time.
What could be a more easier and efficient way out?
I recommend using ASIHTTPRequest to download the images asynchronously, and display them when they're ready. By using the asynchronous interface of that class, your app can be responsive and continue to operate normally while, in the background, you wait for the data to be loaded.
ASIHTTPRequest is open source and free to use: http://allseeing-i.com/ASIHTTPRequest/
The code the Facebook app uses to download and display images has been open-sourced as part of the three20 library.
If you want to write your own networking code ASIHTTPRequest is a very useful library that includes features such as downloading directly to a file and queue management.

creating iphone app for existing site. need advice about the data I'm downloading

I'm building an iPhone app for existing site (a local news site)
Main page with articles headers, when click on them you move to the article page. Simple.
This is the first time I'm building such type of app.
I have 3 general questions, just to make sure :
For the iphone, Do we need to
re-create the website article's
pictures for the iphone ? or there
is some programming tool that on the
fly make the files looks better on
the iphone ? or maybe, there is some
technique that creates one artice
picture that looks right both for
the server and the iphone ?
Usually, Do you need to create
special data channels from the
iPhone webservice ? or programmers
just use the existing rss channels
of the webserver ?
If someone know nice artice about
this stuff, It will help a lot. just
see what other are doing.
thanks.
You can see the intent Media apps, these apps are working like what you want your app to.
1) You're better off creating mobile versions of the images. You can do image processing on the iPhone, but you'll have to have the original and that makes the whole thing pointless (ie. you have to download the whole thing.) Generate a mobile thumbnail when those are uploaded on the server.
2) RSS will do. There's a very good tutorial at cocoadevblog.com about approaching such a task (I guess this covers 75% of the work you have to do)
3) Check 2) ;-)
if your download image is bigger the the thumbnail you are trying to display,
then the problem is in your code that change the image size. check carefully what are you doing to the image after downloading it.
I would recommend to create square thumbnails of your pictures at the server level. This will allow you to easily position in the iPhone screen, plus you will not need to download the whole image from the server.
nnahum

Downloading Images on iPhone - How does Facebook do it?

How does the Facebook app go about downloading/displaying the images in photo galleries? They appear to load in at varying times which would indicate some degree of threading? Surely the app doesn't spawn X amount of threads (where X is the number of pictures) as this would cause performance issues? Can anyone enlighten me as I would like to use something similar in my app (I will be regularly downloading a large amount of photos and displaying them in the app so downloading them one after another takes too long). Also, these photos change on a fairly regular basis so downloading once and cacheing isn't really an option.
Is there some kind of framework/solution around that might help me achieve something similar to Facebooks galleries?
Thanks,
Jack
The code the Facebook app uses to do this has been open-sourced as the three20 library. This functionality is provided in TTPhotoViewController.
Have a look at the LazyTableImages example from Apple. The images are downloaded asynchronously and have a reference back to where they are supposed to be displayed.
I would recommend you use this Library, ASIHTTPRequest, which is like an extended version of the NSURLRequest. I have been using it to download images for later display, asynchronously. It has a nice CACHE implementation which saves bandwidth and loading times on your app.

getting data from server and store in the iPhone

i want to develop an iPhone app where the app downloads data (say audio clips) from a specified server and stores it locally on the device.
then the app should use the data stored in the device rather than stream it from the server.
could anybody give me the guidelines as to how this can be done? tutorials and samples also appreciated. Thanks :)
The easiest way to play files from the internet is to use -[AVAudioPlayer initWithContentsOfURL:error:]. If you want to make sure that the whole file is downloaded, I think your best bet would be to download the file using NSURLConnection (see the URL Loading Guide) and then using -[AVAudioPlayer initWithData:error:].
Look into ASIHTTPRequest, you will find it much easier to fetch large chunks of binary over the web asynchronously than if you try to code everything yourself.