d_01 Posted March 6, 2008 Report Share Posted March 6, 2008 Izveidoju failu, tajā ierakstu tekstu un saglabāju (ar php) Viss kārtībā, tikai vajag lai lietotājs pats izvēlas kā nosaukt un kur šo failu saglabāt. Kā lai uztaisa to explorer logu kurš parādās lai saglabātu failu. līdzīgi kā <input type="file">, bet tas cik saprotu tikai augšuplādei, bet vajag pretēji. Link to comment Share on other sites More sharing options...
andrisp Posted March 6, 2008 Report Share Posted March 6, 2008 (edited) Nevarēs tādu dabūt. Protams, var pats uztaisīt savu file manageri, bet principā tas nav tas pats, kas failu augšupielādējot. Edited March 6, 2008 by andrisp Link to comment Share on other sites More sharing options...
d_01 Posted March 6, 2008 Author Report Share Posted March 6, 2008 slikti var kaut kādi vismaz lai norādītu ceļu uz kurieni saglabāt? Lai lietotājam pašam nevaidzētu rakstīt "C:/Documents and..." Link to comment Share on other sites More sharing options...
andrisp Posted March 6, 2008 Report Share Posted March 6, 2008 Pag, tagad es vairs nesaprotu - tev vajag failu servera pusē saglabāt vai klienta pusē ? Link to comment Share on other sites More sharing options...
d_01 Posted March 6, 2008 Author Report Share Posted March 6, 2008 (edited) vaig klienta pusē, gribēju tā lai nesaglabātos uz servera. bet laikam jau nāksies.. saglabāt uz servera, un linku uz to failu, tad lietotājam parādīsies kur tu to failu vēlies saglabāt un tad jau varēs arī nosaukumu nomainīt ja gribēs. Edited March 6, 2008 by d_01 Link to comment Share on other sites More sharing options...
Zandis Murāns Posted March 6, 2008 Report Share Posted March 6, 2008 Viņš grib, lai, nospiežot linku vai pogu, fails saglabājas viņam uz desktopa. Link to comment Share on other sites More sharing options...
Aleksejs Posted March 6, 2008 Report Share Posted March 6, 2008 (edited) d_01, nē nevar. Vari tikai padot faila nosaukumu. header('Content-Disposition: attachment; filename="faila.nosaukums.papl"'); UPD: upps d_01, nevis d_1 ;) Edited March 6, 2008 by Aleksejs Link to comment Share on other sites More sharing options...
d_01 Posted March 6, 2008 Author Report Share Posted March 6, 2008 (edited) Skaidrs! Paldies! Edited March 6, 2008 by d_01 Link to comment Share on other sites More sharing options...
Aleksejs Posted March 6, 2008 Report Share Posted March 6, 2008 Nu, pamēģini faila nosaukumā padot pilnu ceļu... varbūt, ka paņem pretī... Nu tjipa: header('Content-Disposition: attachment; filename="c:\temp\faila.nosaukums.papl"'); Link to comment Share on other sites More sharing options...
d_01 Posted March 6, 2008 Author Report Share Posted March 6, 2008 Tiku galā! Izrādās šito jau kkad esmu risinājis :) tikai piemirsies bija :) Tātad: taisam pirmo failu kurā ir forma fails_1 <form name="" action="save_to_file.php" method="post"> <input type="hidden" name="data_to_file" value="<?php echo $data_to_file; ?>"> <input type="submit" value="SAGLABĀT!"> </form> un šitais bliež visu ko vien vajag: save_to_file.php <?php header("Content-type:application/octet-stream"); header("Content-Disposition:attachment;filename=fails.txt"); header("Pragma:no-cache"); header("Expires:0"); echo $data_to_excel = $_POST["data_to_file"]; ?> Vai nu ļauj saglabāt kur un kā vajag, vai pat atvērt uzreiz 8) Link to comment Share on other sites More sharing options...
andrisp Posted March 6, 2008 Report Share Posted March 6, 2008 Nesaprotu jēgu visam šitam. Link to comment Share on other sites More sharing options...
d_01 Posted March 6, 2008 Author Report Share Posted March 6, 2008 Jēga ir tāda, ka to var izdarīt! Link to comment Share on other sites More sharing options...
Delfins Posted March 6, 2008 Report Share Posted March 6, 2008 Tas jau ir defaultā... ja vien browseriem MimeTypes nav sačakarēti. Link to comment Share on other sites More sharing options...
Aleksejs Posted March 6, 2008 Report Share Posted March 6, 2008 Visa maģija slēpjas šajā rindiņā: header("Content-type:application/octet-stream"); Iekš windows parasti (vismaz InternetExplorer) ir tieksme vērt daudzas lietas uzreiz pārlūkā. Nu piemēram, atvērt mp3 failu ar kaut kādu tur realplayer, nevis ļaut saglabāt. Tādēļ, norādot pārlūkam, ka sekos izpildāmais fails, tiek panākts, ka automātiski piedāvā Open Save Cancel. Link to comment Share on other sites More sharing options...
Recommended Posts