Jump to content
php.lv forumi

failu ielade uz serveri


JazMan

Recommended Posts

Man palaik ir uztaisiits taa , ka failu ieladei atveras jauns logs, ka var uztaisit taa, lai pec veiksmigas faila ielades galvenaa loga formas laukaaa tiktu ievietota vertiba (faila nosaukums). Varbut kadam ir kads skripts? :rolleyes: :unsure:

Link to comment
Share on other sites

Lieta tada ka failu ielade notiek vienaa loga, bet forma otrajaaa, un kadaa veidaaa var uztaisit taa ka tiko ieladetaa faila nosaukumu pievienot formas laukam :blink:

18587[/snapback]

echo "<input name=\"vards\" type=\"hidden\" value=\"{$vertiba}\">";

pievieno sleeptos laukumus formai un pousto uz priekshu

 

UPD:ups, te laikam pavisam par ko citu runa

Edited by Kristabs
Link to comment
Share on other sites

<?php
include ("conn.php");
$uploaddir = 'uploads/';
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);

print "<pre>";
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {

$basename = ($_FILES['userfile']['name']);
$bilde = $basename;


if (empty($cena)) {
print ("Nesaņēmu cenu!<br>");
}
elseif (empty($izmers)) {
print ("Nesaņēmu izmēru!<br>");
}

else {
$result = @mysql_query("insert into gleznas values(null,'$bilde','$cena','$izmers')");
@mysql_free_result('$result');
echo "<script language=\"javascript\">location='m.php'</script>";
}
} else {
print "Kautkas nesanāca:\n";
print_r($_FILES);
}
print "</pre>";

?>

 

Uz localhost viss bija O.K., bet uz servera izdrukaa:

 

Warning: move_uploaded_file(uploads/IMGP1202.jpg): failed to open stream: Permission denied in /home/hosting/interjers/upload2.php on line 7

Warning: move_uploaded_file(): Unable to move '/tmp/phpKe49em' to 'uploads/IMGP1202.jpg' in /home/hosting/interjers/upload2.php on line 7
Kautkas nesanāca:
Array
(
[userfile] => Array
(
[name] => IMGP1202.jpg
[type] => image/pjpeg
[tmp_name] => /tmp/phpKe49em
[error] => 0
[size] => 77526
)

)

Kas pa vainu?

Edited by Gizmo
Link to comment
Share on other sites

  • 2 weeks later...

admin. caur web? vispār jau vajadzēja ne Apacim klāt (httpd.conf), bet failu sistēmas tiesībām tikt klāt, however varbūt apacim lietotāju pamainīja, tagad no php

<?php
  chmod('fails',0755);
?>

kļūdu vēl met?

Link to comment
Share on other sites

Sorry, kautkas nesanāk, kur lai iisti ievieto to chmod? Un ko apziimee 'fails' ?

Tas tak nau jaaliek jau formaa?

<?php
include ("conn.php");
$uploaddir = 'uploads/';
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
print "<pre>";
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {

$basename = ($_FILES['userfile']['name']);
$bilde = $basename;


if (empty($cena)) {
print ("Nesaņēmu cenu!<br>");
}
elseif (empty($izmers)) {
print ("Nesaņēmu izmēru!<br>");
}

else {
$result = @mysql_query("insert into gleznas values(null,'$bilde','$cena','$izmers')");
@mysql_free_result('$result');
echo "<script language=\"javascript\">location='m.php'</script>";
}
} else {
  print "Kautkas nesanāca:\n";
  print_r($_FILES);
}
print "</pre>";

?>

Link to comment
Share on other sites

×
×
  • Create New...