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
! 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)
<?php
if($subaction == "upload")
{
if(!$image){ $image = $HTTP_POST_FILES['image']['tmp_name']; }
if(!$image_name){ $image_name = $HTTP_POST_FILES['image']['name']; }
$img_name_arr = explode(".",$image_name);
$type = end($img_name_arr);
if($image_name == ""){ $img_result = "<br><font color=red>No File Specified For Upload !!!</font>"; }
elseif( !isset($overwrite) and
file_exists($config_path_image_upload."/".$image_name)){ $img_result = "<br><font color=red>Image already exist !!!</font>";}
$img_result = "<br><font color=red>This type of file is not allowed !!!</font>";
}
else
{
@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";
if(file_exists($config_path_image_upload."/".$image_name))
{
$img_result = "<br><font color=green>Image was uploaded</font>";
if($action == "quick"){
$img_result .= " <a title="Inser this image in the $my_area" href="javascript:insertimage('<img style="border: none;" alt="" src="$config_http_script_dir/data/upimages/$image_name" />')">[insert it]</a>";
}
}//if file is uploaded succesfully
}
}
?>
a to formularz:
<table border=0 cellpading=0 cellspacing=0 width=100%>
<FORM action='$PHP_SELF?mod=images' METHOD='POST' ENCTYPE=\"multipart/form-data\">
<input type=hidden name=subaction value=upload>
<input type=hidden name=area value='$area'>
<input type=hidden name=action value='$action'>
<table border=0 cellpading=0 cellspacing=0 class=\"panel\" cellpadding=8>
<input type=file name=image size=23> <input type=submit value='Upload'><br> <input type=checkbox name=overwrite value=1> Overwrite if exist?
<img height=20 border=0 src=\"skins/images/blank.gif\" width=1>
......