Uploading files in Android and IOS

Hi,

I’m developing an app for IOS and Android which uploading files to a server through HTTP(post/put). For images, the WWW/WWWform class works well, same for videos which are quite small < 50 mb. But for larger files >50~mb i get “out of memory”- exception.

This is because when the app read the file it stores it in the RAM until it’s uploaded.

WWW localFile = new WWW("file:///" + localFileName);
 yield return localFile;
  if (localFile.error == null)
            Debug.Log("Loaded file successfully");
	else
        {
            Debug.Log("Open file error: "+localFile.error);
            yield break; // stop the coroutine here
        }

Is there any way to chunk the data or is it possible to stream it through HTTP?

I have the possibility to upload through FTP aswell, but as far as I have understand the FTP support is limited in Unity3d.

Bump!

hi , did you solved the issue ? im having same issue here

Same problem here :confused: I can’t send large files on android.

E/dalvikvm-heap(19330): Out of memory on a 23393512-byte allocation.
I/dalvikvm(19330): "Thread-1299" prio=5 tid=21 RUNNABLE
I/dalvikvm(19330):   | group="main" sCount=0 dsCount=0 obj=0x42f4b640 self=0x789ccb48
I/dalvikvm(19330):   | sysTid=20271 nice=0 sched=0/0 cgrp=apps handle=2106730800
I/dalvikvm(19330):   | state=R schedstat=( 131573429 29466518 173 ) utm=7 stm=6 core=2
I/dalvikvm(19330):   at java.io.ByteArrayOutputStream.expand(ByteArrayOutputStream.java:~91)
I/dalvikvm(19330):   at java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java:201)
I/dalvikvm(19330):   at com.android.okhttp.internal.http.RetryableOutputStream.write(RetryableOutputStream.java:64)
I/dalvikvm(19330):   at com.unity3d.player.WWW.runSafe((null):-1)
I/dalvikvm(19330):   at com.unity3d.player.WWW.run((null):-1)

Is there a way to fix this without native extensions?

Ok, I’m using WebClient now and it works great, I can upload 100mb+ files without any problems.