Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [jquery] Uploadify - Zwracanie bledow
chiken
post
Post #1





Grupa: Zarejestrowani
Postów: 27
Pomógł: 0
Dołączył: 31.07.2006
Skąd: Czeladź

Ostrzeżenie: (0%)
-----


Witam,

staram sie podpiac dodawanie plikow przez uploadify, mam problem odnosnie zwracania bledow,

(IMG:http://img693.imageshack.us/img693/8136/plik2.jpg)

Jak ustawie w js rozmiar pliku jaki moze byc, to ladnie pokazuje blad, ale chce zrobic sprawdzanie dodatkowych bledow przez php, i je zwracac, w pliku upload_ext.php, w onComplete zwraca alerta jesli jest jakis blad ale chcialbym zrobic aby blad wygladal tak samo jak np. informacja ze plik za duzy.

  1.  
  2. $(document).ready(function() {
  3. $("#fileUpload2").fileUpload({
  4. 'uploader': 'uploadify/uploader.swf',
  5. 'cancelImg': 'uploadify/cancel.png',
  6. 'script': 'uploadify/upload_ext.php',
  7. 'folder': 'files',
  8. 'multi': true,
  9. 'auto': true,
  10. 'buttonText': 'Wybierz pliki',
  11. 'displayData': 'speed',
  12. 'simUploadLimit': 2,
  13. 'sizeLimit': '2000000',
  14.  
  15.  
  16. onError: function (a, b, c, d) {
  17. if (d.status == 404)
  18. alert('Could not find upload script. Use a path relative to: '+'<?= getcwd() ?>');
  19. else if (d.type === "HTTP")
  20. alert('error '+d.type+": "+d.status);
  21. else if (d.type ==="File Size")
  22. alert(c.name+' '+d.type+' Limit: '+Math.round(d.sizeLimit/1024)+'KB');
  23. else
  24. alert('error '+d.type+": "+d.text);
  25. },
  26. onComplete: function(a, b, c, d, e){
  27. if (d !== '1')
  28. alert(d);
  29. },
  30. 'fileDesc': 'Php file,JPG Image Files (*.jpg), GIF(*.gif)',
  31. 'fileExt': '*.php;*.jpg;*.gif;',
  32. });
  33.  
  34. });
  35.  


plik upload_ext.php zwraca :

  1. If ($msg)
  2. $stringData = "Error: ".$_FILES['Filedata']['error']." Error Info: ".$msg;
  3. else
  4. $stringData = "1"; // This is required for onComplete to fire on Mac OSX
  5.  
  6. echo $stringData;



$stringData - jest przekazywany do alerta w oncomplete

jak ktos moze pomoc chetnie poslucham , bo juz kilka godzin to mecze i nic mi nie wpada do glowy (IMG:style_emoticons/default/biggrin.gif)
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 23.12.2025 - 23:48