image not displaying

Started on the old forum in April 2016 · view the original in the archive · old links redirect here

3 replies · 152 views · started 10 years ago · 1 min read

3 participants
thunderwap Developer · 169 posts #1

hello

when i try to upload a image then it moves to the directory where i want. but the image does not shows up.what is the problem with this code. i get error

Warning: Cannot modify header information - headers already sent by (output started at /home/mysite/public_html/database.php:47) in /home/mysite/public_html/sharefile.php on line 13

**```php

<?php include("database.php"); include("function.php"); connectdb(); $fileid = mysql_real_escape_string ($_GET["fileid"]); $sid = mysql_real_escape_string ($_GET["sid"]); $file = mysql_fetch_array(mysql_query("SELECT filename, touid FROM fileshare WHERE id=$fileid")); $uid = mysql_fetch_array(mysql_query("SELECT uid FROM session WHERE id='".$sid."'")); $uid = $uid[0]; if ($file[1] == $uid){ header("Location: fileshare/".$file[0]); } else{ header("Content-type: text/html"); echo "<html><p>This file is not yours!<br/><a href="index.php?action=main&sid=$sid">Home</a></p></html>"; } ?>

i also defined destination folder with variable in database.php where file image should be moved. file gets move in destination folder but image is not displaying when user tries to download the image. and user gets error msg

**Warning**: Cannot modify header information - headers already sent by (output started at /home/mysite/public_html/database.php:47) in**/home/mysite/public_html/sharefile.php** on line **13**

WANT GOOD CHEAP HOSTING WITH 99% UPTIME? THEN PM ME FOR DETAILS!!

something else Fellow · 2,296 posts #2

Remove the output (html) in database.php

The function header() must come before all html

thunderwap Developer · 169 posts #3

something else wrote: Remove the output (html) in database.php

The function header() must come before all html

there is no html output in database.php there is only variables defined between

<?php  

?>

the problem is fixed.my mistake was that i leaved blank space after ?>

so this maked me problem.my whole day was passed yesterday to solve this problem but today in morning it solved. i forgot to check the blank lines or space in database.php

thank you so much.

WANT GOOD CHEAP HOSTING WITH 99% UPTIME? THEN PM ME FOR DETAILS!!

andre3 Developer · 192 posts #4

thunderwap wrote: there is no html output in database.php there is only variables defined between

<?php

?>

the problem is fixed.my mistake was that i leaved blank space after ?>

so this maked me problem.my whole day was passed yesterday to solve this problem but today in morning it solved. i forgot to check the blank lines or space in database.php

thank you so much.

Sweet man, well done!

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close