Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Problem z uploadem plików
profusik
post
Post #1





Grupa: Zarejestrowani
Postów: 9
Pomógł: 0
Dołączył: 6.07.2005

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


Mam pytanie odnośnie uploadu plików.
Nie mogę skopiować pliku na serwer (ver php 5.0.4). Gdy wskazuję plik i potem chcę go "zuploadować" to nic się nie dzieje. Pokazuje mi komunikat No File Specified For Upload exclamation.gif! tak jakbym nie wskazał żadnego pliku. Gdy naprawdę nie wskazuje to pokazuje mi to samo. Czyli zmienna $image_name jest pusta.
U siebie lokalnie mogę i wszystko działa (ver php 4.3.4)
  1. <?php
  2. if($subaction == "upload")
  3.  
  4. {
  5.  
  6. if(!$image){ $image = $HTTP_POST_FILES['image']['tmp_name']; }
  7.  
  8. if(!$image_name){ $image_name = $HTTP_POST_FILES['image']['name']; }
  9.  
  10. $image_name = str_replace(" ", "_", $image_name);
  11.  
  12.  
  13.  
  14. $img_name_arr = explode(".",$image_name);
  15.  
  16. $type = end($img_name_arr);
  17.  
  18.  
  19.  
  20. if($image_name == ""){ $img_result = "<br><font color=red>No File Specified For Upload !!!</font>"; }
  21.  
  22. elseif( !isset($overwrite) and file_exists($config_path_image_upload."/".$image_name)){ $img_result = "<br><font color=red>Image already exist !!!</font>";}
  23.  
  24. elseif( !(in_array($type, $allowed_extensions) or in_array(strtolower($type), $allowed_extensions)) ){
  25.  
  26. $img_result = "<br><font color=red>This type of file is not allowed !!!</font>";
  27.  
  28. }
  29.  
  30. else
  31.  
  32. {
  33.  
  34. @copy($image, $config_path_image_upload."/".$image_name) or $img_result = "<font color=red>Couldn't copy image to server</font><br />Check if file_uploads is allowed in the php.ini file of your server";
  35.  
  36. if(file_exists($config_path_image_upload."/".$image_name))
  37.  
  38. {
  39.  
  40. $img_result = "<br><font color=green>Image was uploaded</font>";
  41. if($action == "quick"){
  42. $img_result .= " <a title="Inser this image in the $my_area" href="javascript:insertimage('&lt;img style=&quot;border: none;&quot; alt=&quot;&quot; src=&quot;$config_http_script_dir/data/upimages/$image_name&quot; /&gt;')">[insert it]</a>";
  43. }
  44. }//if file is uploaded succesfully
  45.  
  46. }
  47.  
  48. }
  49.  
  50. ?>

a to formularz:
  1. <table border=0 cellpading=0 cellspacing=0 width=100%>
  2.  
  3. <FORM action='$PHP_SELF?mod=images' METHOD='POST' ENCTYPE=\"multipart/form-data\">
  4.  
  5. <input type=hidden name=subaction value=upload>
  6.  
  7. <input type=hidden name=area value='$area'>
  8.  
  9. <input type=hidden name=action value='$action'>
  10.  
  11. <td height=33>
  12.  
  13. <b>Upload Image</b>
  14.  
  15. <table border=0 cellpading=0 cellspacing=0 class=\"panel\" cellpadding=8>
  16.  
  17. <tr>
  18.  
  19. <td height=25>
  20.  
  21. <input type=file name=image size=23>&nbsp;&nbsp; <input type=submit value='Upload'><br>
  22. <input type=checkbox name=overwrite value=1> Overwrite if exist?
  23.  
  24. <b>$img_result</b></tr>
  25.  
  26. </form>
  27.  
  28. </table>
  29.  
  30. <tr>
  31.  
  32. <td height=11>
  33.  
  34. <img height=20 border=0 src=\"skins/images/blank.gif\" width=1>
  35.  
  36. </tr>
  37. ......
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
mhs
post
Post #2





Grupa: Zarejestrowani
Postów: 764
Pomógł: 3
Dołączył: 30.04.2003

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


Cytat
Ciekawe czemu bo wnioskując z różnych porad i manuala to chyba właśnie o to chodziło.


Lokalnie pracowałeś na wersji 4.x, natomiast na serwerze masz wersję 5.x. Różnica polega na tym, że administrator serwera wyłączył możliwość korzystania z długich nazw tablic globalnych, czyli wyłaczył w sposób w jaki Ty z nich korzystałeś. Dyrektywa odpowiedzialna za włączenie/wyłączenie tej opcji znajduje się w pliku konfiguracyjnym php.ini.

Pozdrawiam.
Go to the top of the page
+Quote Post

Posty w temacie


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

 



RSS Aktualny czas: 19.08.2025 - 11:34