roberc Posted August 4, 2003 Report Posted August 4, 2003 varbuut kaads zin kaadu skripta piemeera linku bilzhu aploudam uz web serveri ? tipa forma ar texta lauku un pogu BROWSE, tad upload. a PHP to sagremo un saglabaa... cik esu mekleejis, visur kriit aaraa ASP piemeeri, kas man ir gauzhaam nepievilciigi
Roze Posted August 4, 2003 Report Posted August 4, 2003 <code><font color="#000000"> <form method='post' enctype="multipart/form-data" action='<font color="#0000CC"><? </font><font color="#006600">echo </font><font color="#0000CC">$PHP_SELF</font><font color="#006600">; </font><font color="#0000CC">?></font>'> <input type='file' name='myfile'> <input type='submit'> </form> <font color="#0000CC"><? </font><font color="#006600">if(</font><font color="#0000CC">$_FILES</font><font color="#006600">[</font><font color="#0000CC">myfile</font><font color="#006600">][</font><font color="#0000CC">tmp_name</font><font color="#006600">]) { </font><font color="#0000CC">[url=http://lv.php.net/copy]copy[/url]</font><font color="#006600">(</font><font color="#0000CC">$_FILES</font><font color="#006600">[</font><font color="#0000CC">myfile</font><font color="#006600">][</font><font color="#0000CC">tmp_name</font><font color="#006600">],</font><font color="#CC0000">"/direktorija/"</font><font color="#006600">.</font><font color="#0000CC">$_FILES</font><font color="#006600">[</font><font color="#0000CC">myfile</font><font color="#006600">][</font><font color="#0000CC">name</font><font color="#006600">]); } </font><font color="#0000CC">?> </font> </font> </code> Papildus: http://lv.php.net/manual/en/features.file-upload.php http://lv.php.net/copy
Roze Posted August 4, 2003 Report Posted August 4, 2003 p.s. ja neegribaas lietot superglobals tad $_FILES[myfile][tmp_name] vietaa vienkaarshi var likt $myfile un $_FILES[myfile][name] attieciigi $myfile_name
fassko Posted August 4, 2003 Report Posted August 4, 2003 a ir vajadziigs mapei kur viss atrodas writes tiesiibas ???
jannis Posted August 4, 2003 Report Posted August 4, 2003 nu ja tev kaads linux, tad protams. ka vajag un vispaar kods apmeeram shaads: <code><font color="#000000"> if (is_uploaded_file($HTTP_POST_FILES['file_name']['tmp_name'])) { copy($HTTP_POST_FILES['file_name']['tmp_name'], "../tmp/$realname"); } else { echo "Possible file upload attack. Filename: " . $_FILES['file_name']['name']; } if (move_uploaded_file($_FILES['file_name']['tmp_name'], "$realname")) { echo "<b>File $realname was uploaded succesfully!</b>"; unlink("../tmp/$realname"); } } </font> </code>
roberc Posted August 6, 2003 Author Report Posted August 6, 2003 paldies! tas ir tieshi tas, kas bij vajadziigs.
fassko Posted August 6, 2003 Report Posted August 6, 2003 a kuraa vietaa jaaskataas vai ir writes tiesiibas mapei ?
tamster Posted August 9, 2003 Report Posted August 9, 2003 a kuraa vietaa jaaskataas vai ir writes tiesiibas mapei ? <code><font color="#000000"> <font color="#0000CC"><? </font><font color="#006600">if(</font><font color="#0000CC">[url=http://lv.php.net/is_writable]is_writable[/url]</font><font color="#006600">(</font><font color="#CC0000">"/mape/"</font><font color="#006600">)){ echo </font><font color="#CC0000">"Rakstām"</font><font color="#006600">; }else{ echo </font><font color="#CC0000">"Nesanāks..."</font><font color="#006600">; } </font><font color="#0000CC">?></font> </font> </code>
Recommended Posts