ricshs Posted June 23, 2006 Report Share Posted June 23, 2006 index.php <form action="upload.php" method="post" enctype="multipart/form-data"> <input type="hidden" name="MAX_FILE_SIZE" value="70"> Select a file <input type="file" name="userfile"><br> <input type="submit" value="Upload!"> upload.php <?php if(!(copy($_FILES['userfile']['tmp_name'], "Upload/" . $_FILES['userfile']['name']))) die("Cannot upload files."); echo "Upload Complete!"; ?> Kā uztaisīt, lai varētu upot tikai .avi vai .mpeg failus ? Link to comment Share on other sites More sharing options...
bubu Posted June 23, 2006 Report Share Posted June 23, 2006 php skriptā paskaties vai faila nosaukums beidzas ar .avi vai .mpeg (pirms tava copy). Link to comment Share on other sites More sharing options...
ricshs Posted June 23, 2006 Author Report Share Posted June 23, 2006 Kā to saprast pirms mana copy??? Ja zini kā var uploadot tikai .avi un .mpeg, tad pasaki ludzu! Link to comment Share on other sites More sharing options...
v3rb0 Posted June 23, 2006 Report Share Posted June 23, 2006 (edited) ja tikai pēc filenames nosaki, tad $chunks = explode('.',$_FILES['userfile']['name']); if(in_array($chunks[count($chunks)-1]), array('avi','mpeg', 'whatever')) .. Edited June 23, 2006 by v3rb0 Link to comment Share on other sites More sharing options...
bubu Posted June 23, 2006 Report Share Posted June 23, 2006 ricshs: savu kodu jau esi aizmirsis un nejēdz uz savu postu paskatīties? Link to comment Share on other sites More sharing options...
ricshs Posted June 23, 2006 Author Report Share Posted June 23, 2006 kādēļ aizmirsis??? Link to comment Share on other sites More sharing options...
bubu Posted June 23, 2006 Report Share Posted June 23, 2006 Nu ja pats brīnies, kas par copy, ko tev teicu. Link to comment Share on other sites More sharing options...
ricshs Posted June 23, 2006 Author Report Share Posted June 23, 2006 Tu zini, ka tu neskaidri runā? No tevis nekā nevar saprast... Link to comment Share on other sites More sharing options...
bubu Posted June 23, 2006 Report Share Posted June 23, 2006 Nu jopcig. Tu iedevi kodu, kurā ir copy fjas izsaukums. Es tev pateicu, ko pirms copy fjas izsaukuma ielikt. Un nākamajā postā tu brīnies, kas par copy funkciju. Un to es nesaprotu. Link to comment Share on other sites More sharing options...
Tvinky Posted June 28, 2006 Report Share Posted June 28, 2006 Ar preg_match nevar pārbaudīt? Link to comment Share on other sites More sharing options...
ricshs Posted June 29, 2006 Author Report Share Posted June 29, 2006 Un kā tas izskatītos ? Link to comment Share on other sites More sharing options...
bubu Posted June 29, 2006 Report Share Posted June 29, 2006 Tvinky: priekš kam tur preg_match vajag, tu pasaki? Kam strstr vai str_pos domātas? Link to comment Share on other sites More sharing options...
Recommended Posts