Jump to content
php.lv forumi

upload


kalabox

Recommended Posts

reku kodiņš lai uploadotu failu.

<form enctype="multipart/form-data" action="upload.php" method="POST">

<input type="hidden" name="MAX_FILE_SIZE" value="100000" />

Choose a file to upload: <input name="uploadedfile" type="file" /><br />

<input type="submit" value="Pievienot" />

</form>

 

<?php

Rezultāt ir "uploads/filename.extension" */

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

$_FILES['uploadedfile']['tmp_name'];

?>

 

un jautājums kapēc mapē uploads neko nepievieno??

 

kaut gan stipri šaubos, ka kods arī ir pareizs.. :D

Link to comment
Share on other sites

omfg. Ko tu ar to kodu domāji izdarīt?

 

Rezultāt ir "uploads/filename.extension" */ - beidzas komentārs, bet nekur neākas - te tev būs errors!

$target_path = $target_path . basename( $_FILES['uploadedfile']['name']); - uzseto mainīgo

$_FILES['uploadedfile']['tmp_name']; - vispār neko nedara

 

Kur tu pārvieto failu no temp diras uz tev vajadzīgo?

 

 

move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path);

Edited by ohmygod
Link to comment
Share on other sites

×
×
  • Create New...