473,513 Members | 2,319 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

display the image uploaded using session id

20 New Member
I have uploaded an image using the student_id as its filename. The student id is auto-incremented and unique per student_id. Now i am confused why it gives me problem to display it. I have tried.

Expand|Select|Wrap|Line Numbers
  1.   <?php print '<img src="uploads/'.$session_id.'" />' ?>
  2.  
  3.   <?php print '<img src="uploads/'.$session_id.".".$ext'" />' ?>
  4.  
  5.   <?php print '<img src="uploads/'.$student_id.'" />' ?>
  6.  
  7.   <img src='uploads/".$actual_image_name."' class='profile-photo' align="middle"> //where $actual_image_name = $student_id.".".$ext;
  8.  
but still the image wont display
Aug 19 '14 #1
6 3808
Exequiel
288 Contributor
You did not put php tag in your image src.
Expand|Select|Wrap|Line Numbers
  1. <img src="uploads/<?php echo $actual_image_name; ?>" class="profile-photo" align="middle">
  2.  
Aug 24 '14 #2
hanspeare
20 New Member
hi Exequiel,

I tried your codes but it shows me errors and the rest of the page wont display. i revised it and this is my complete codes now. A working page but the image still wont display.

Expand|Select|Wrap|Line Numbers
  1. <?php 
  2. $actual_image_name = time().".";
  3. mysql_query("UPDATE users SET profile_image='$actual_image_name' WHERE student_id='{$_SESSION['user_id']}'",$link_id);
  4. echo "<img src='uploads/".$actual_image_name."'  class='profile-photo'>";
  5. ?>
  6.  
Aug 26 '14 #3
Exequiel
288 Contributor
did you save to your database if what extension type your image are? like filename.jpg/jpeg/png/bmp/gif etc.
Aug 28 '14 #4
hanspeare
20 New Member
@Exequiel:

Yes file name extensions like jpg, png, and gif are being accepted. I suspect the code

$actual_image_name = time().".";

,,is wrong in

time()

becuase the time of upload and the time of display is not same,,would it matter? if it matters? Can you suggest me a filename to use for the uploaded file so that i can call and display it easily??
Aug 29 '14 #5
Exequiel
288 Contributor
yes it matters, because in your displaying you used time() function so that result to the time right now but the time you inserted to database is different, must better if you get the value that you inserted to database (the image name in table) than to use time() function in displaying.
Aug 29 '14 #6
hanspeare
20 New Member
thank you very much for the patience Exequiel, finally i solve it with the help of your confirmation.
Oct 9 '14 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

7
2849
by: Philipp Lenssen | last post by:
I created Search.CSS which grabs Google results (using the Web API), displays as XHTML1.0 Strict + CSS, and recently also adds Thumbnails....
0
2266
by: Satish Appasani | last post by:
Hi: I have a ASP.NET form with Web layout which I've achieved using panels. In one of the tab I have a File control to upload Images. When I put a file in the file control and move to another...
1
5865
by: Tan | last post by:
Hi I am desperate for any help with display image in Gridview I have a gridview contain surname , forename ..... and image. I could not display image as my database store the column image as...
2
2879
by: Abhishek Srivastava | last post by:
Hello All, I am trying to obtain an image asynchronously for this I have written code which uses XMLHTTP object to retreive the image. now I have to display this image in an iframe. when I say...
3
5224
by: den 2005 | last post by:
Hi everyone, Here is code working on..Trying to insert record with a column with Image or VarBinary datatype in sql database from a existing jpeg image file, then retrieve this image from...
6
1953
by: hsegoy1979 | last post by:
Dear All Iam new to asp.net. I want to display image on server machine uploaded from client machine using javascript. Any Help Thankx in Advance Yogesh
8
1615
by: zizi2 | last post by:
Hi, I have a webform that uload images as well. The image is uploaded well but the problem arises when the user does not upload any image. I want the form to save nothing for the image_name in the...
1
2563
by: sakura | last post by:
Hi. I'm using asp.net and c# language. How can i display a GridView using select statement of two column in one table? This is my coding: if (sdr.Read()) { if(namaPembekal.Equals(sdr)...
1
2404
by: zak200 | last post by:
Hi, I am trying to display image , but its not working. #!C:/Perl64/bin/perl.exe print "Content-type: image/gif\n\n"; print <<EOF; <HTML> <HEAD> <TITLE> Coding Page </TITLE> </Head>
0
7177
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7394
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7123
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7542
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5100
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4756
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3248
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
811
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
470
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.