jazzman1 Posted August 25, 2013 Share Posted August 25, 2013 O my God it was my fault. Re-read my reply #17 and change this: echo '<img src="$the_file" />'; exit; to echo '<img src='.$the_file. '/>'; exit; I quoted a variable name. Sorry for that. Quote Link to comment https://forums.phpfreaks.com/topic/281450-download-file-glitch/page/2/#findComment-1446603 Share on other sites More sharing options...
rhs49010 Posted August 25, 2013 Author Share Posted August 25, 2013 I added echo '<img src='.$the_file. '/>'; exit; no more error. now it's back to the black square with an X Quote Link to comment https://forums.phpfreaks.com/topic/281450-download-file-glitch/page/2/#findComment-1446604 Share on other sites More sharing options...
jazzman1 Posted August 25, 2013 Share Posted August 25, 2013 Put ini_set("display_errors", "1"); on the top of the file and delete that line - echo '<img src='.$the_file. '/>'; exit; Quote Link to comment https://forums.phpfreaks.com/topic/281450-download-file-glitch/page/2/#findComment-1446605 Share on other sites More sharing options...
rhs49010 Posted August 25, 2013 Author Share Posted August 25, 2013 Put ini_set("display_errors", "1"); on the top of the file and delete that line - echo '<img src='.$the_file. '/>'; exit; Trueint(108) Warning: Cannot modify header information - headers already sent by (output started at /home1/ecosolu1/public_html/lrn/download_file.php:34) in /home1/ecosolu1/public_html/lrn/download_file.php on line 41 Plus a load of gibberish Quote Link to comment https://forums.phpfreaks.com/topic/281450-download-file-glitch/page/2/#findComment-1446606 Share on other sites More sharing options...
rhs49010 Posted August 25, 2013 Author Share Posted August 25, 2013 does this need output buffering? Quote Link to comment https://forums.phpfreaks.com/topic/281450-download-file-glitch/page/2/#findComment-1446607 Share on other sites More sharing options...
jazzman1 Posted August 25, 2013 Share Posted August 25, 2013 Too much errors! Try to create this app from beginning and debug every variables and outputs carefully. Sorry, I'm out. Quote Link to comment https://forums.phpfreaks.com/topic/281450-download-file-glitch/page/2/#findComment-1446608 Share on other sites More sharing options...
rhs49010 Posted August 25, 2013 Author Share Posted August 25, 2013 Your not going to believe this but It WORKS!!!!!!! I deleted... if (!is_dir('/upload')) { echo "True"; } else { echo "False"; } and the var dump ($uid) and voile it now sends a download window! So what? was it the var dump? try it for yourself http://www.lrn.computerizedgraphics.com/view_files.php I'll be dammed Now I can finally move on to the next headache. Thank you Thank you Thank you Quote Link to comment https://forums.phpfreaks.com/topic/281450-download-file-glitch/page/2/#findComment-1446611 Share on other sites More sharing options...
rhs49010 Posted August 25, 2013 Author Share Posted August 25, 2013 Oh by the way download the daffy.jpg That's about how I was feeling about the download file. Quote Link to comment https://forums.phpfreaks.com/topic/281450-download-file-glitch/page/2/#findComment-1446612 Share on other sites More sharing options...
jazzman1 Posted August 25, 2013 Share Posted August 25, 2013 (edited) He-he....cool....good for you...there were too many outputs on the same html document But..I'm still surprise why this did not work. $the_file = 'uploads/108'; // dump this result to be sure that everything is fine echo '<img src='.$the_file. '/>'; exit; By the way, for multiple files uploading, I'm using this API -> http://www.plupload.com/ http://www.plupload.com/example_queuewidget.php Edited August 25, 2013 by jazzman1 Quote Link to comment https://forums.phpfreaks.com/topic/281450-download-file-glitch/page/2/#findComment-1446613 Share on other sites More sharing options...
rhs49010 Posted August 25, 2013 Author Share Posted August 25, 2013 He-he....cool....good for you...there were too many outputs on the same html document But..I'm still surprise why this did not work. $the_file = 'uploads/108'; // dump this result to be sure that everything is fine echo '<img src='.$the_file. '/>'; exit; By the way, for multiple files uploading, I'm using this API -> http://www.plupload.com/ http://www.plupload.com/example_queuewidget.php Thanks, I'll bookmark it! Quote Link to comment https://forums.phpfreaks.com/topic/281450-download-file-glitch/page/2/#findComment-1446614 Share on other sites More sharing options...
jazzman1 Posted August 25, 2013 Share Posted August 25, 2013 Yep...because we have to have an empty space after the variable! Can you try this for me, please! $the_file = 'uploads/108'; // dump this result to be sure that everything is fine echo '<img src='.$the_file. ' />'; exit; Quote Link to comment https://forums.phpfreaks.com/topic/281450-download-file-glitch/page/2/#findComment-1446615 Share on other sites More sharing options...
mac_gyver Posted August 25, 2013 Share Posted August 25, 2013 the <img tag doesn't work because the src=' ... ' attribute must be the actual url of the file so that the browser can fetch the file. the files are not stored using the id as their name. the id is the upload_id value in the database table that corresponds to the actual filename.ext the file is stored as. the <img tag syntax is also missing quotes in the html around the src=' ... ' attribute. Quote Link to comment https://forums.phpfreaks.com/topic/281450-download-file-glitch/page/2/#findComment-1446617 Share on other sites More sharing options...
mac_gyver Posted August 25, 2013 Share Posted August 25, 2013 all the echoing of test strings was preventing the headers from working (after the original problems were corrected.) if you had php's error_reporting/display_errors turned full on, you would have known this hours ago. Quote Link to comment https://forums.phpfreaks.com/topic/281450-download-file-glitch/page/2/#findComment-1446618 Share on other sites More sharing options...
jazzman1 Posted August 25, 2013 Share Posted August 25, 2013 (edited) the <img tag doesn't work because the src=' ... ' attribute must be the actual url of the file so that the browser can fetch the file. the files are not stored using the id as their name. the id is the upload_id value in the database table that corresponds to the actual filename.ext the file is stored as. the <img tag syntax is also missing quotes in the html around the src=' ... ' attribute. I think this is apache conf issue. On my web server, binary files as (jpg's, png's, pdf's) do not required to have ext in the end. Edited August 25, 2013 by jazzman1 Quote Link to comment https://forums.phpfreaks.com/topic/281450-download-file-glitch/page/2/#findComment-1446619 Share on other sites More sharing options...
rhs49010 Posted August 25, 2013 Author Share Posted August 25, 2013 Well This was a learning experience for me. it wasn't a total waste of time for me at least Jazzman1 and mac_gyver you guys are probably going to ignore me If I come back with my next headache. I'll give this a try for grins Jazzman1 $the_file = 'uploads/108'; // dump this result to be sure that everything is fine echo '<img src='.$the_file. ' />'; exit; I'll be back Quote Link to comment https://forums.phpfreaks.com/topic/281450-download-file-glitch/page/2/#findComment-1446620 Share on other sites More sharing options...
rhs49010 Posted August 25, 2013 Author Share Posted August 25, 2013 $the_file = 'uploads/108'; // dump this result to be sure that everything is fine echo '<img src='.$the_file. ' />'; exit; That displays the image in the browser Quote Link to comment https://forums.phpfreaks.com/topic/281450-download-file-glitch/page/2/#findComment-1446621 Share on other sites More sharing options...
jazzman1 Posted August 25, 2013 Share Posted August 25, 2013 (edited) Cool! Now you know what simple an empty space causes in the script! Read these! 1. Debugging: A Beginner's guide 2. How To Ask Questions The Smart Way 3. Php security tutorial Edited August 25, 2013 by jazzman1 Quote Link to comment https://forums.phpfreaks.com/topic/281450-download-file-glitch/page/2/#findComment-1446623 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.