Pereiti prie turinio

Upload scriptas reikia pagalbos


Rekomenduojami pranešimai

Stai scriptas,bet kazkodel neuploadina failu,gal galite paziureti?

// Where the file is going to be placed 
$target_path = "../ikelimai/";

/* Add the original filename to our target path.  
Result is "uploads/filename.extension" */
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']); 
$_FILES['uploadedfile']['tmp_name'];  

$target_path = "../ikelimai/";

$target_path = $target_path . basename( $_FILES['uploadedfile']['name']); 

if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
echo "The file ".  basename( $_FILES['uploadedfile']['name']). 
" has been uploaded. File address: ". $target_path;
} else{
echo "There was an error uploading the file, please try again!";
}

Redagavo tomola
Nuoroda į pranešimą
Dalintis kituose puslapiuose
Stai scriptas,bet kazkodel neuploadina failu,gal galite paziureti?

// Where the file is going to be placed 
$target_path = "[b]../i[/b]kelimai/";

/* Add the original filename to our target path.  
Result is "uploads/filename.extension" */
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']); 
$_FILES['uploadedfile']['tmp_name'];  

$target_path = "[b]../[/b]ikelimai/";

$target_path = $target_path . basename( $_FILES['uploadedfile']['name']); 

if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
echo "The file ".  basename( $_FILES['uploadedfile']['name']). 
" has been uploaded. File address: ". $target_path;
} else{
echo "There was an error uploading the file, please try again!";
}

tie ../ reiškia 1 folderiu atgal, t.y. jei sis failas yra mano/failai/index.php ikelimai folderiai reikia kurti mano folderyje.

Dar kas gali būti tai, kad nesuchmodinai ikelimai.

Nuoroda į pranešimą
Dalintis kituose puslapiuose
Stai scriptas,bet kazkodel neuploadina failu,gal galite paziureti?

// Where the file is going to be placed 
$target_path = "../ikelimai/";

/* Add the original filename to our target path.  
Result is "uploads/filename.extension" */
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']); 
$_FILES['uploadedfile']['tmp_name'];  

$target_path = "../ikelimai/";

$target_path = $target_path . basename( $_FILES['uploadedfile']['name']); 

if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
echo "The file ".  basename( $_FILES['uploadedfile']['name']). 
" has been uploaded. File address: ". $target_path;
} else{
echo "There was an error uploading the file, please try again!";
}

 

1) Kaip jau minėjo, tavo upload'inami failai turi būtį 'auštesnėje' diroje;

2) Juk ar taip sunku patesuoti ar yra išvis iš formos gaunamas failas?

3) Naudok savo kodus, tokiam dalykui didelių žinių nereikia.

Paprasčiausiai, tame puslapyje, kur turi gauti failą, pažiurėk ar ateina failas kur reikia. Toliau ką reikia iš jo išgauk panaudodamas

<?php print_r($_FILES); ?> ir tt, ech ir nekils bėdų.

 

Čia tiesiog elementari failo įkėlimo formą, ją pateikia 90% PHP/HTML manual'ų. :D

Sėkmės.

Nuoroda į pranešimą
Dalintis kituose puslapiuose

vietoj "move_uploaded_file" bandyk parasyti "copy".

 

// Where the file is going to be placed 
$target_path = "../ikelimai/";

/* Add the original filename to our target path.  
Result is "uploads/filename.extension" */
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']); 
$_FILES['uploadedfile']['tmp_name'];  

$target_path = "../ikelimai/";

$target_path = $target_path . basename( $_FILES['uploadedfile']['name']); 

if(copy($_FILES['uploadedfile']['tmp_name'], $target_path)) {
echo "The file ".  basename( $_FILES['uploadedfile']['name']). 
" has been uploaded. File address: ". $target_path;
} else{
echo "There was an error uploading the file, please try again!";
}

Nuoroda į pranešimą
Dalintis kituose puslapiuose
  • Dabar naršo   0 narių

    Nei vienas registruotas narys šiuo metu nežiūri šio puslapio.

×
×
  • Pasirinkite naujai kuriamo turinio tipą...