justsomeguy Posted October 3, 2012 Share Posted October 3, 2012 The code that was given in this thread can stand on its own. You've pasted that code into a much larger script that has output, so that's the problem. Make that code its own file instead. Link to comment Share on other sites More sharing options...
westman Posted October 3, 2012 Author Share Posted October 3, 2012 i did and am still getting nowhere Link to comment Share on other sites More sharing options...
justsomeguy Posted October 3, 2012 Share Posted October 3, 2012 Show all of the code for your download script. We can't answer questions if you're not providing information. Link to comment Share on other sites More sharing options...
westman Posted October 4, 2012 Author Share Posted October 4, 2012 ok i got good news and badi can download my images with this code... header('Content-Description: File Transfer');header('Content-Type: image/jpeg');header("Content-Disposition: attachment; filename=mypic.jpg");readfile('images/pics/3.jpg'); it works fine and has been tested with different type of .jpg filesbut when i download the .jpg file needed i can not open it and i get a windows error..."Windows photo viewer can't open this picture because the file appears to be bamaged, currupted, or is too large." Link to comment Share on other sites More sharing options...
Ingolme Posted October 4, 2012 Share Posted October 4, 2012 It sounds like you might have some unnecessary spaces or line breaks at the end or the middle of the file. readfile() should be the very last thing in your code, and there shouldn't be any spaces or line breaks anywhere else either. Keep all your code inside a single <?php ?> block and make sure that it's on the very first line of the document and that there aren't any blank lines after it.Save the file as UTF-8 without BOM. Link to comment Share on other sites More sharing options...
westman Posted October 4, 2012 Author Share Posted October 4, 2012 got it working ;)the problem was my $i was using... readfile('images/$pics/3.jpg');and now i am using... readfile('images/' . $pics . '/3.jpg');and its all working fine thank you every one for your help Link to comment Share on other sites More sharing options...
westman Posted October 4, 2012 Author Share Posted October 4, 2012 (edited) is it possible to download 2 or 3 .jpg files at the same time with my download script? Edited October 4, 2012 by westman Link to comment Share on other sites More sharing options...
justsomeguy Posted October 4, 2012 Share Posted October 4, 2012 Not with one script. You're telling the browser that you're sending a file, with a filename, type, etc, then the data. That's a single file. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now