Skip to content

Instantly share code, notes, and snippets.

@mcfdn
Created October 23, 2012 16:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mcfdn/3939744 to your computer and use it in GitHub Desktop.
Save mcfdn/3939744 to your computer and use it in GitHub Desktop.
jQuery File Upload Return Json
$jsonArray = array();
foreach($photos as $i => $photo) {
$jsonArray[$i]['name'] = $photo->getName();
$jsonArray[$i]['size'] = $photo->getSize();
$jsonArray[$i]['url'] = $photo->getUrl();
$jsonArray[$i]['thumbnail_url'] = $photo->getThumbnailUrl();
$jsonArray[$i]['delete_url'] = 'delete-photo.php?id=' . $photo->getId();
}
echo json_encode($jsonArray);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment