Ver Mensaje Individual
  #5 (permalink)  
Antiguo 16/11/2011, 00:09
elcapitolio
 
Fecha de Ingreso: mayo-2011
Mensajes: 167
Antigüedad: 13 años, 5 meses
Puntos: 1
Respuesta: Alguien me puede apoyar con FancyUpload ?

este es el link de mi proyecto....
http://chivascienega.com/admin/fotos2.php

en el formulario la accion la tiene hacia script.php
el cual vendria siento este....

Código PHP:
Ver original
  1. <?php
  2. /**
  3.  * Swiff.Uploader Example Backend
  4.  *
  5.  * This file represents a simple logging, validation and output.
  6.  *  *
  7.  * WARNING: If you really copy these lines in your backend without
  8.  * any modification, there is something seriously wrong! Drop me a line
  9.  * and I can give you a good rate for fancy and customised installation.
  10.  *
  11.  * No showcase represents 100% an actual real world file handling,
  12.  * you need to move and process the file in your own code!
  13.  * Just like you would do it with other uploaded files, nothing
  14.  * special.
  15.  *
  16.  * @license     MIT License
  17.  *
  18.  * @author      Harald Kirschner <mail [at] digitarald [dot] de>
  19.  * @copyright   Authors
  20.  *
  21.  */
  22.  
  23.  
  24. /**
  25.  * Only needed if you have a logged in user, see option appendCookieData,
  26.  * which adds session id and other available cookies to the sent data.
  27.  *
  28.  * session_name('SID'); // whatever your session name is, adapt that!
  29.  * session_start();
  30.  */
  31.  
  32. // Request log
  33.  
  34. /**
  35.  * You don't need to log, this is just for the showcase. Better remove
  36.  * those lines for production since the log contains detailed file
  37.  * information.
  38.  */
  39.  
  40. $result = array();
  41.  
  42. $result['time'] = date('r');
  43. $result['addr'] = substr_replace(gethostbyaddr($_SERVER['REMOTE_ADDR']), '******', 0, 6);
  44. $result['agent'] = $_SERVER['HTTP_USER_AGENT'];
  45.  
  46. if (count($_GET)) {
  47.     $result['get'] = $_GET;
  48. }
  49. if (count($_POST)) {
  50.     $result['post'] = $_POST;
  51. }
  52. if (count($_FILES)) {
  53.     $result['files'] = $_FILES;
  54. }
  55.  
  56. // we kill an old file to keep the size small
  57. if (file_exists('script.log') && filesize('script.log') > 102400) {
  58.     unlink('script.log');
  59. }
  60.  
  61. $log = @fopen('script.log', 'a');
  62. if ($log) {
  63.     fputs($log, print_r($result, true) . "\n---\n");
  64.     fclose($log);
  65. }
  66.  
  67.  
  68. // Validation
  69.  
  70. $error = false;
  71.  
  72. if (!isset($_FILES['Filedata']) || !is_uploaded_file($_FILES['Filedata']['tmp_name'])) {
  73.     $error = 'Invalid Upload';
  74. }
  75.  
  76.  
  77.  if (!$error && $_FILES['Filedata']['size'] > 2 * 1024 * 1024)
  78. {
  79.     $error = 'Please upload only files smaller than 2Mb!';
  80. }
  81. /**
  82.  * You would add more validation, checking image type or user rights.
  83.  *
  84.  
  85.  
  86.  
  87. if (!$error && !($size = @getimagesize($_FILES['Filedata']['tmp_name']) ) )
  88. {
  89.     $error = 'Please upload only images, no other files are supported.';
  90. }
  91.  
  92. if (!$error && !in_array($size[2], array(1, 2, 3, 7, 8) ) )
  93. {
  94.     $error = 'Please upload only images of type JPEG, GIF or PNG.';
  95. }
  96.  
  97. if (!$error && ($size[0] < 25) || ($size[1] < 25))
  98. {
  99.     $error = 'Please upload an image bigger than 25px.';
  100. }
  101. */
  102.  
  103.  
  104. // Processing
  105.  
  106. /**
  107.  * Its a demo, you would move or process the file like:
  108.  *
  109.  * move_uploaded_file($_FILES['Filedata']['tmp_name'], '../uploads/' . $_FILES['Filedata']['name']);
  110.  * $return['src'] = '/uploads/' . $_FILES['Filedata']['name'];
  111.  *
  112.  * or
  113.  *
  114.  * $return['link'] = YourImageLibrary::createThumbnail($_FILES['Filedata']['tmp_name']);
  115.  *
  116.  */
  117.  
  118.  move_uploaded_file($_FILES['Filedata']['tmp_name'], '../uploads/' . $_FILES['Filedata']['name']);
  119.  $return['src'] = '/uploads/' . $_FILES['Filedata']['name'];
  120.  or
  121.  $return['link'] = YourImageLibrary::createThumbnail($_FILES['Filedata']['tmp_name']);
  122.  
  123.  
  124. if ($error) {
  125.  
  126.     $return = array(
  127.         'status' => '0',
  128.         'error' => $error
  129.     );
  130.  
  131. } else {
  132.  
  133.     $return = array(
  134.         'status' => '1',
  135.         'name' => $_FILES['Filedata']['name']
  136.     );
  137.  
  138.     // Our processing, we get a hash value from the file
  139.     $return['hash'] = md5_file($_FILES['Filedata']['tmp_name']);
  140.  
  141.     // ... and if available, we get image data
  142.     $info = @getimagesize($_FILES['Filedata']['tmp_name']);
  143.  
  144.     if ($info) {
  145.         $return['width'] = $info[0];
  146.         $return['height'] = $info[1];
  147.         $return['mime'] = $info['mime'];
  148.     }
  149.  
  150. }
  151.  
  152.  
  153. // Output
  154.  
  155. /**
  156.  * Again, a demo case. We can switch here, for different showcases
  157.  * between different formats. You can also return plain data, like an URL
  158.  * or whatever you want.
  159.  *
  160.  * The Content-type headers are uncommented, since Flash doesn't care for them
  161.  * anyway. This way also the IFrame-based uploader sees the content.
  162.  */
  163.  
  164. if (isset($_REQUEST['response']) && $_REQUEST['response'] == 'xml') {
  165.     // header('Content-type: text/xml');
  166.  
  167.     // Really dirty, use DOM and CDATA section!
  168.     echo '<response>';
  169.     foreach ($return as $key => $value) {
  170.         echo "<$key><![CDATA[$value]]></$key>";
  171.     }
  172.     echo '</response>';
  173. } else {
  174.     // header('Content-type: application/json');
  175.  
  176.     echo json_encode($return);
  177. }
  178.  
  179. ?>

Pero no puedo hacerlo funcionar.. alguien me puede ayudar un poco??