• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
0
Question by subjectZero · Apr 08, 2016 at 10:56 AM · iosvideofacebookwwwformandriod

how to send file (local path) using wwwForm on iOS and Android?

Hey Peeps

We are trying to upload a file a video file on Facebook using wwwForm but i don't think i have the correct local path for the device.

here is the code we are using:

 public void PostVideo(string VideoLocStr)
 {
     Debug.Log (VideoLocStr);
     this.StartCoroutine(this.StartVideoUpload(VideoLocStr));
 }

 private IEnumerator StartVideoUpload(string VideoLocStr)
 {
     yield return new WaitForEndOfFrame();

     WWW www = new WWW("file:///Users/" + VideoLocStr);
     while(!www.isDone) {
         yield return null;
         Debug.Log("progress : "+www.progress);
     }
     Debug.Log("size : "+www.size);
     var wwwForm = new WWWForm();
     wwwForm.AddBinaryData("file", www.bytes, "Video.MOV","multipart/form-data");
     wwwForm.AddField("title", "Hello World");
     wwwForm.AddField("description", "How you doing?");

     FB.API("123456789/videos", HttpMethod.POST, UploadFinish, wwwForm);
 }

This is the error that it spits out:

 result : [BaseResult: Error=bad request, Result=System.Collections.Generic.Dictionary`2[System.String,System.Object], RawResult={"error":{"message":"There was a problem uploading your video file. Please try again.","type":"OAuthException","code":381,"error_subcode":1363021,"is_transient":false,"error_user_title":"Video Upload Problem","error_user_msg":"There was a problem uploading your video. Please try again.","fbtrace_id":"DIY4Zuvn0bO"}}, Cancelled=False] , error : bad request

can't find any information on the error searching with google or on the Facebook developer website.

Does anyone know what the correct file path should be for iOS and Android?

Thank you for your time.

Kind Regards

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image subjectZero · Apr 11, 2016 at 10:37 AM 0
Share

Hey Peeps. we are stills struggling to get this right. We are using a asset called CameraShot. and it returns a path where the video is saved, which is:

/var/mobile/Containers/Data/Application/73F271CF-5DC4-497E-845B-2B45F19AABEA/Documents/CameraShot/11-04-2016 12:36:30.mov

so why do we get the error when trying to upload the file?

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by subjectZero · Apr 11, 2016 at 11:16 AM

hey peeps,

finally figured it out. you must define the spaces. here is the solution:

     String pathForIOS = VideoLocStr.Replace (" ","%20");
     WWW form = new WWW("file:" + pathForIOS);

rock on!

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

65 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Need help with issues using the VideoPlayer released in Unity 5.6 1 Answer

How do I create a Boomerang video 0 Answers

VideoPlayer Crash on iOS Launch 0 Answers

Unity Facebook SDK v7.9.0 totally doesn't work on iOS (Unity version 5.3.2) 1 Answer

VideoPlayer doesn't work on iOS 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges