0

Possible Duplicate:
Upload Progress Bar in PHP

I have been researching this with no success.

I have a php script which uploads a picture to Facebook. On the main page I want to show a button or a link or an image which starts a progress bar and runs the upload script at background.

Here is the upload.php file:

<?php 

include_once 'facebook.php';
include_once 'config.php';

$facebook = new Facebook(array(
'appId'  => FACEBOOK_APP_ID,
'secret' => FACEBOOK_SECRET_KEY,
'fileUpload' => true,
));

$uid = $facebook->getUser();
$me = $facebook->api('/me');

$FILE = "images/$uid.jpg";//the file is already stored   

$args = array('message' => 'Check yours on: http://apps.facebook.com/dec-death');
$args['image'] = '@' . realpath($FILE);

$data = $facebook->api('/'.$uid.'/photos', 'post', $args);

echo 'Picture has been uploaded';

?>
Community
  • 1
  • 1
Simran
  • 51
  • 1
  • 4

2 Answers2

1

There is nothing to do with these you tagged! alternatively you can make an ajax call. so before ajax call you will start animation and on end you will hide/complete the animation!

Waqar Alamgir
  • 9,828
  • 4
  • 30
  • 36
0

You would need to call your upload script via AJAX (Asynchronously) , and get the upload status during the upload to present a progress bar. There are great jQuery plugins already doing that such as Uploadify

As one already commented here, this was asked so many times - So please next time just search before posting.

Lightness Races in Orbit
  • 378,754
  • 76
  • 643
  • 1,055
Shai Mishali
  • 9,224
  • 4
  • 56
  • 83