473,395 Members | 1,774 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

display the image uploaded using session id

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

✓ answered by Exequiel

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.

6 3780
Exequiel
288 256MB
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
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 256MB
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
@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 256MB
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
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
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
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
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
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
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
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
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
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
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
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.