while am using file upload control in the content
type=="pjpeg" then it will execute,but if the content
type=="jpeg" it is not execute.What it is the meaning of
i.e:"pjpeg" i want to upload all type of images like
jpeg,bmp,gif etc..,and that image is display in the "image
control" when am click the Button click event...HOW..
Plz replay ...

Answers were Sorted based on User's Feedback



while am using file upload control in the content type=="pjpeg" then it will execute,but ..

Answer / vikaskaundal40@gmail.com

firstly img convert to binery and which uesd in file stream
and read the file access mode and again you covert the img
in bytes and again used in file stream and write and
retrive the img and you upload all type img in very easly

Is This Answer Correct ?    1 Yes 0 No

while am using file upload control in the content type=="pjpeg" then it will execute,but ..

Answer / vinod patil

Just to polish the topic off, below are the two files that
have been tested
on my machine (xp, apache2, php 4.3.9, mysql4.0.1x)

<?php
//show_image.php

require("conn.php");
//check to see if the id is passed
if(isset($_GET['id'])) {
$id=$_GET['id'];


$query = "select bin_data, filetype from binary_data where
id=$id";
//echo $query;
$result = connect($query);
$row = mysql_fetch_array($result);
{
$data = $row['bin_data'];
$type = $row['filetype'];
}
if ($type=="pjpeg") $type = "jpeg";
Header( "Content-type: $type");

echo $data;

}
?>

<?php

// show_desc.php
require("conn.php");

// you may have to modify login information for your
database server

$query = "select description, id from binary_data ";
$result = connect($query);

while ($rows = MYSQL_FETCH_ARRAY($result))
{
echo $rows['description'];
echo "<br><br>";

echo "<img src=\"show_image.php?id=".$rows['id']."\">\n";


};
?>

And I used table structure

CREATE TABLE binary_data (
id INT(4) NOT NULL AUTO_INCREMENT PRIMARY KEY,
description CHAR(50),
bin_data LONGBLOB,
filename CHAR(50),
filesize CHAR(50),
filetype CHAR(50)
);

hth

bastien

>From: Chip Wiegand <chip.wiegand@simrad.com>
>To: bastien_k@hotmail.com
>CC: "PHP DB" <php-db@lists.php.net>
>Subject: RE: [PHP-DB] storing images in database
>Date: Tue, 25 Jan 2005 12:57:40 -0800
>
>"Bastien Koert" <bastien_k@hotmail.com> wrote on 01/25/2005
12:46:12 PM:
>
> > yes goes back to the whole header problem which is why
you are here.
> >
> > If you could post the code, it would be simpler to help
you...
> >
> > Bastien
>
>This is in the main page -
><?
>printf("<p><img src=\"image-src.php?id=$id\" alt=\"hotspot
>images\">%s</p>", $row["text"]);
>?>
>and this is in a new included page -
><?
>if($_GET['id']) {
>$id = $_GET['id'];
>$query = "select * from hotspots where id=$id";
>$result = @MYSQL_QUERY($query);
>
>$data = @MYSQL_RESULT($result,0,"image");
>$type = @MYSQL_RESULT($result,0,"type");
>
>Header( "Content-type: $type");
>echo $data;
>};
>?>
>The database connection statements are in an include file
called at the
>top of the main page. In the first statement shown above
the alt text for
>the image appears on the web page just fine, the image
itself shows a
>broken image icon. FWIW, I have the image stored in the
database in a blob
>field, is that correct?
>--
>Chip
>
> > >From: Chip Wiegand <chip.wiegand@simrad.com>
> > >To: bastien_k@hotmail.com
> > >Subject: RE: [PHP-DB] storing images in database
> > >Date: Tue, 25 Jan 2005 12:44:44 -0800
> > >
> > >"Bastien Koert" <bastien_k@hotmail.com> wrote on
01/25/2005 12:39:15
>PM:
> > >
> > > > Its not src='id=$id'> that will defnintely blow up....
> > > >
> > > > echo '<img src="./path/to/image.php?id=$id">';
> > > >
> > > > where $id is the id of the record you are trying to
get the image
>to...
> > > >
> > > > Bastien
> > >
> > >So the code has to be a seperate included page I guess?
> > >--
> > >Chip
> > >
> > > > >From: Chip Wiegand <chip.wiegand@simrad.com>
> > > > >To: bastien_k@hotmail.com
> > > > >CC: php-db@lists.php.net
> > > > >Subject: RE: [PHP-DB] storing images in database
> > > > >Date: Tue, 25 Jan 2005 12:37:15 -0800
> > > > >
> > > > >Thanks Bastien,
> > > > >In testing this I have added the code samples to a
page and have it
> > > > >working except the path statement is not correct.
For now, I've
>just
> > >added
> > > > >all the code to one page, rather than including a
second page. The
> > > > >statement - echo '<img src="id=$id">'; is resulting
in this error -
>The
> > > > >requested URL /id=$id was not found on this server. Any
>suggestions?
> > > > >Thanks,
> > > > >Chip
> > > > >
> > > > >"Bastien Koert" <bastien_k@hotmail.com> wrote on
01/25/2005
>09:45:39
> > >AM:
> > > > >
> > > > > > the best way to do this is to move the image
processing code to
>a
> > > > >separate
> > > > > > page and include it like this
> > > > > >
> > > > > > echo '<img src="./path/to/image.php?id=$id">';
> > > > > >
> > > > > > then the image page looks like this:
> > > > > > <?php
> > > > > >
> > > > > > if($_GET['id']) {
> > > > > > $id = $_GET['id'];
> > > > > > // you may have to modify login information for
your database
> > >server:
> > > > > > @MYSQL_CONNECT("localhost","root","password");
> > > > > >
> > > > > > @mysql_select_db("binary_data");
> > > > > >
> > > > > > $query = "select bin_data,filetype from
binary_data where
>id=$id";
> > > > > > $result = @MYSQL_QUERY($query);
> > > > > >
> > > > > > $data = @MYSQL_RESULT($result,0,"bin_data");
> > > > > > $type = @MYSQL_RESULT($result,0,"filetype");
> > > > > >
> > > > > > Header( "Content-type: $type");
> > > > > > echo $data;
> > > > > >
> > > > > > };
> > > > > > ?>
> > > > > >
> > > > > > bastien
> > > > > >
> > > > > >
> > > > > >
> > > > > > >From: Chip Wiegand <chip.wiegand@simrad.com>
> > > > > > >To: "PHP DB" <php-db@lists.php.net>
> > > > > > >Subject: [PHP-DB] storing images in database
> > > > > > >Date: Tue, 25 Jan 2005 09:11:07 -0800
> > > > > > >
> > > > > > >I have stored a .jpg image in a database, then
when I make a
>sql
> > > > >statement
> > > > > > >to display that image on a web page all I get
is the cryptic
>code
> > >in
> > > > >place
> > > > > > >of the image. I am storing it in a row
configured as a blob,
>mime
> > >type
> > > > > > >image/jpeg and binary (using phpMyAdmin). What
am I doing
>wrong?
> > > > > > >Regards,
> > > > > > >Chip
> > > > > > >
> > > > > > >--
> > > > > > >PHP Database Mailing List (http://www.php.net/)
> > > > > > >To unsubscribe, visit: http://www.php.net/unsub.php
> > > > > > >
> > > > > >
> > > > > > --
> > > > > > PHP Database Mailing List (http://www.php.net/)
> > > > > > To unsubscribe, visit: http://www.php.net/unsub.php
> > > > > >
> > > > >
> > > >
> > > >
> > >
> >
> >
>

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More DotNet Errors Interview Questions

how to track links visited in google using iframes in dotnet

1 Answers  


not being able to create delivery from vl01n inspite of assigning sales order and delivery plz answer it immediately if any one knows

1 Answers  


Hi everyone, I got some problem this week. I don't know the coding for "Linklabel" in C#.net. In ASP.net, I use it "Response.Redirect" and "Server.Transfer" and I also can use hyperlink. When offline I use "linklabel", Now I still write by "System.Dianogstic", It still showing error and can't reach my dedicated page(Means design page). So if anyone know it, please share your technical help. Thanks (Horace Trever)

1 Answers  


In .net how many error will occur?

0 Answers   Chevrolet, TCS,


What is Difference Between Server.Response and Response.Redirect in ASP.Net with C#?

1 Answers   Infosys, NIIT,






How to use singal crystal report viewer to multiple reports?

1 Answers   Sparsh,


how we change the .net 1.0 to .net 2.0?is that can we only paste the dll file?

1 Answers  


Hi Everyone, I used VB.net until last year, this year I change my language to C#.net.But the easy one in VB.net such as "Set as Start page when running program", right click on solution explorer and do it. But in C#.net I can't find the way to do (Set as start page)until now. If anyone know it , please share your technical help. Thanks . (Horace Trever)

4 Answers  


Weather I can use Dotnet framework 1.0 and 2.0 in same machine for Two application or not if "Yes" then how will configure in IIS for Framework 1.0 and 2.0 First Application will be working in .net Frame work 1.0 Send will be .net Frame work 2.0 How to Configure IIS for both Application using Virtual Directory I tried but when Confirte 1.0 then Second Application not working which is having 2.0 Framework but when Conf. 2.0 then Send Application works but First app. Not Work ...... How I Configure IIS for both Application Throwing ERR "The web application you are attempting to access on this web server is currently unavailable. Please hit the "Refresh" button in your web browser to retry your request. " After Hitting Refresh Button also not works...... ?

2 Answers   ISST,


What is Managerial Grid? Contract its approach to leadership with the approaches of the Ohio state and Michigan groups.

1 Answers  


How to find out syntax error by manual testing

3 Answers  


while am using file upload control in the content type=="pjpeg" then it will execute,but if the content type=="jpeg" it is not execute.What it is the meaning of i.e:"pjpeg" i want to upload all type of images like jpeg,bmp,gif etc..,and that image is display in the "image control" when am click the Button click event...HOW.. Plz replay ...

2 Answers  


Categories