Junal on the run

Uploading files from Facebook ….

Posted on: February 18, 2008

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:

Array

(

[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:

http://wiki.developers.facebook.com/index.php/Files_Easy_Uploads

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.

After clicking on the link, it brings you this log in page and you upload your files.

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.

2 Responses to "Uploading files from Facebook …."

Set your form action url to your own server. Facebook will generate all other necessary variable in form for script to verify user credetial.

Excellent post.. thank for sharing ..🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

View Junal Rahman's profile on LinkedIn
Subscribe to me on FriendFeed

Follow Me on Twitter

Archives

My photos

Downtown, Ottawa

Dream

Jasper, AB

Jasper, AB

Banff, AB

Folkfest, Bangladesh Pavilion Saskatoon

Lovely Sky

Stunt bikers on summer festival, Saskatoon

More Photos

Blog Stats

  • 420,271 hits
%d bloggers like this: