Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: PROBLEM SKRYPT UPLOAD.PHP LINIA 51
Forum PHP.pl > Forum > PHP
MrCandiPL
Witam mam problem a niewiem gdzie pisze mi że jest to linia [51] ale niewiem jaki jest tam błąd.

  1. <?php
  2.  
  3. $site_name = $_SERVER['HTTP_HOST'];
  4. $url_dir = "http://".$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']);
  5. $url_this = "http://".$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'];
  6.  
  7. $upload_dir = "/";
  8. $upload_url = $url_dir."/";
  9. $message ="";
  10.  
  11. //create upload_files directory if not exist
  12. //If it does not work, create on your own and change permission.
  13. if (!is_dir("upload_files")) {
  14. die ("upload_files directory doesn't exist");
  15. }
  16.  
  17. if ($_FILES['userfile']) {
  18. $message = do_upload($upload_dir, $upload_url);
  19. }
  20. else {
  21. $message = "Invalid File Specified.";
  22. }
  23.  
  24. print $message;
  25.  
  26. function do_upload($upload_dir, $upload_url) {
  27.  
  28. $temp_name = $_FILES['userfile']['tmp_name'];
  29. $file_name = $_FILES['userfile']['name'];
  30. $file_type = $_FILES['userfile']['type'];
  31. $file_size = $_FILES['userfile']['size'];
  32. $result = $_FILES['userfile']['error'];
  33. $file_url = $upload_url.$file_name;
  34. $file_path = $upload_dir.$file_name;
  35.  
  36. //File Name Check
  37. if ( $file_name =="") {
  38. $message = "Invalid File Name Specified";
  39. return $message;
  40. }
  41. //File Size Check
  42. else if ( $file_size > 50000000) {
  43. $message = "Masymalny rozmiar pliku wynosi 50MB.";
  44. return $message;
  45. }
  46. //File Type Check
  47. else if ( $file_type == "text/plain/" ) {
  48. $message = "Przepraszamy, nie obslugujemy takich rozszezen!" ;
  49. return $message;
  50. }
  51. $result = move_uploaded_file($temp_name, $file_path);
  52. $message = ($result)?"File url <a href=$file_url>$file_url</a>" :
  53. "Somthing is wrong with uploading a file.";
  54.  
  55. return $message;
  56. }
  57. ?>
  58. <form name="upload" id="upload" ENCTYPE="multipart/form-data" method="post">
  59. Upload Image<input type="file" id="userfile" name="userfile">
  60. <input type="submit" name="upload" value="Upload">
  61. </form>
  62.  
Damonsson
Temat: Jak poprawnie zadac pytanie
com
to może komunikat błędu by się podało a najlepiej zapytało google co on oznacza tongue.gif a nie od razu na forum z tym przylatujecie..
Kshyhoo
I zapytamy wróżkę, jaki to błąd smile.gif
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.