hoho Posted October 11, 2011 Report Share Posted October 11, 2011 Datu bāzē fails ir saglabāts kā BLOB, fails pielikumā. Kā no ta heša uzģenerēt failu? Piemēram es gribu visu saturu saglabāt failā aaa.jpg: header("Content-length: 35748"); header("Content-type: image/jpeg"); header("Content-Disposition: attachment; filename=aaa.jpg"); file_put_contents ("aaa.jpg", ***saturs no file.txt***); Fails tiek uzģenerēts, bet atvērs nevaru ... No preview available ... file.txt Quote Link to comment Share on other sites More sharing options...
briedis Posted October 11, 2011 Report Share Posted October 11, 2011 Izskatās, ka viņš ir base64 nokodēts. file_put_contents("fails", base64_decode(saturs)); Vienīgi nesaprotu, priekš kam tu sūti to headeri? file_put_contents nav pilnīgi nekāda sakara ar header() funkciju. Quote Link to comment Share on other sites More sharing options...
hoho Posted October 11, 2011 Author Report Share Posted October 11, 2011 Mēģinu bez headeriem vienkārši file_put_contents("fails", base64_decode(saturs));. Faila izmērs uzģenerējas cits, bet atvērt vienalga nevaru. Vai Tu pats vari no tā mana koda uzģenerēt bildi? Fails ir .jpg formātā. Quote Link to comment Share on other sites More sharing options...
marrtins Posted October 11, 2011 Report Share Posted October 11, 2011 Tas BLOB tur ir nevis JPEG, bet ZIP arhīvs ar saturu file.1, kas ir JPEG fails. Quote Link to comment Share on other sites More sharing options...
hoho Posted October 11, 2011 Author Report Share Posted October 11, 2011 Paldies! Tagad viss ir skaidrs! :) Quote Link to comment Share on other sites More sharing options...
briedis Posted October 11, 2011 Report Share Posted October 11, 2011 Atgādināšu, ka header() funkcija nosūta headerus PĀRLŪKAM, nevis kaut kā iespaido koda darbību, kā, piemēram, file_put_contents() izsaukumu. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.