CapturePanorama.CapturePanorama.UploadImage C# (CSharp) Method

UploadImage() private method

private UploadImage ( byte imageFileBytes, string filename, string mimeType, bool async ) : IEnumerator
imageFileBytes byte
filename string
mimeType string
async bool
return IEnumerator
        IEnumerator UploadImage(byte[] imageFileBytes, string filename, string mimeType, bool async)
        {
            float startTime = Time.realtimeSinceStartup;

            WWWForm form = new WWWForm();

            form.AddField("key", apiKey);
            form.AddField("action", "upload");
            form.AddBinaryData("source", imageFileBytes, filename, mimeType);

            WWW w = new WWW(apiUrl + "upload", form);
            yield return w;
            if (!string.IsNullOrEmpty(w.error))
            {
                Debug.LogError("Panorama upload failed: " + w.error, this);
                if (failSound != null && Camera.main != null)
                    audioSource.PlayOneShot(failSound);
            }
            else
            {
                Log("Time to upload panorama screenshot: " + (Time.realtimeSinceStartup - startTime) + " sec");
                if (!captureEveryFrame && doneSound != null && Camera.main != null)
                {
                    audioSource.PlayOneShot(doneSound);
                }
            }
            Capturing = false;
        }