Jump to content
php.lv forumi

File Upload


spynode

Recommended Posts

Labi es uztaisiju shaadu primitiiivu skriptu, un taa pat vinjsh nestraadaa. -

 

 

 

function piev_bildi() {

 

if (isset($_POST['gid'])) {

$gid = $_POST['gid'];

move_uploaded_file($_FILES['userfile']['tmp_name'], "../bildes/".$gid."/");}

 

echo '<form enctype="multipart/form-data" action="admin.php?darbs=piev_bildi" method="post">

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

Galerija:<input name="gid"><br>

Bilde: <input name="userfile" type="file">

<input type="submit" value="Send File">

</form>';}

 

Luudzu kaads paliidziet man saprast, kur es esmu kluudijies.

Edited by spynode
Link to comment
Share on other sites

Te "../bildes/".$gid."/" galaa vajag noraadiit arii pasha jaunaa faila nosaukumu.

Ja gribi saglabaat tieshi taadu kaadu uuseris uploadee tad:

 

"../bildes/".$gid."/".$_FILES['userfile']['name']

 

Preteeji tev tagad fails tiek movots par direktoriju (nevis uz jo peec php dokumentacijas " If the file is valid, it will be moved to the filename given by destination.") kas nav korekti..

Link to comment
Share on other sites

×
×
  • Create New...