Uploading files from Facebook ….
Posted February 18, 2008on:
Sometimes strange things happen. I write some code and it’s not working. Strange errors! Well, certainly I have done something wrong – otherwise why it would generate wrong code in live site when it works fine in the local site?
I was trying to upload files from facebook. In other way, I had to allow users to upload their own files in facebook. First, I tried file uploading from local server and after uploading a file my $_FILE array would generate an array like bellow:
[uploadedfile] => Array
[name] => Junal.jpg
[type] => image/jpeg
[tmp_name] => D:\wamp\tmp\php7.tmp
[error] => 0
[size] => 34693
But as soon as I moved these codes to live site my $_FILE array didn’t work and it was returning me an empty array! Strange! Form method was “Post” and I submitted a picture! What is wrong with it? I kept trying and trying…..
After trying several times I realized that my code was all right and then I moved to facebook WIKI and found this solution bellow:
So it gives you a link where user can store their files and later this file can be called from your callback URL, I got a relief once I found it. It worked for me well. I had to sign in as a user and it returned me an array of file links and stuff to my callback URL.
I got all necessary link from my $_GET array. Later, all I had to do is, putting these all links in a database table. And that’s it rest of the things same.
To see an example code of this file uploading you can visit here: http://enabled.box.net/fb/simpleupload.phps
So why Facebook would not allow users to upload their files on their own way ? uhm, I guess its because they want to make sure right file is uploading and no copyright files being uploaded.
Is there any other way we can upload files in facebook? I’m very much interested to know about it. please let me know.