It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming PHP and MySQL Forum

Show upload files in my browser

Moderator: Malcolm

Postby jeaddy on Sat Feb 16, 2008 9:48 pm

I have a couple of issue and was hoping if you could help me.

1- I have the codes to upload pix and show them in the browser, but in only does it for one pix at a time and the last one uploaded.
I would like to show all the pixs in the database with the last one uploaded showed last, I tried for the past two days to do this but haven't found any
solution. if you have any let me know.

this is the code on the bottom that does this;


<code>
<?php

// Connect to database

$errmsg = "";
if (! @mysql_connect("localhost","TEST1","TEST")) {
$errmsg = "Cannot connect to database";
}
@mysql_select_db("test");


$q = <<<CREATE
create table pix (
pid int primary key not null auto_increment,
title text,
imgdata longblob)
CREATE;
@mysql_query($q);


// Insert any new image into database

//-------------------------------------------------------------------------------------------
move_uploaded_file($_FILES['imagefile']['tmp_name'],"lates.img");
//MOVE UPLOADED FILE TO A NEW LOCATION
$inst = fopen("lates.img","rb");
$image = addslashes(fread($inst,filesize("lates.img")));

mysql_query ("insert into pix2 (title, imgdata) values (\""."\", \"".$image."\")");
//--------------------------------------------------------------------------------------------------
$gotten = @mysql_query("select imgdata from pix2 order by pid desc");

if ($row = @mysql_fetch_assoc($gotten)) {
$bytes = $row[imgdata];
} else {
$errmsg = "There is no image in the database yet";
$title = "no database image available";
$inst = fopen("../wellimg/ctco.jpg","rb");
$bytes = fread($inst,filesize("../wellimg/ctco.jpg"));
}

if ($_REQUEST[gim] == 1) {
header("Content-type: image/jpeg");
print $bytes;
exit ();
}


?>

<html><head>
<title>Upload an image to a database</title>
<body bgcolor=tan><h2>Here's the latest picture</h2>
<font color=red><?php $errmsg ?></font>
<center><img src=?gim=1 width=1000 height=1000><br> <!--144-->
<b><?php $title ?></center>
<hr>
<h2>Please upload a new picture and title</h2>
<form enctype=multipart/form-data method=post>
<input type=hidden name=MAX_FILE_SIZE value=15000000>
<input type=hidden name=completed value=1>
Please choose an image to upload: <input type=file name=imagefile><br>
Please enter the title of that picture: <input name=whatsit><br>
then: <input type=submit></form><br>
<hr>
</body>
</html>

</code>


2 - do you know if or the codes to upload music and excel files to the database and show them on the browser? I was thinking that maybe I should do it as I
did it for pix and change it to xls for excel docs, etc.

thanks[code][/code]
jeaddy
 
Posts: 24
Joined: Thu Dec 20, 2007 12:35 am

Women warning dating website. Dating games play.

Postby emehanofeni on Fri Dec 02, 2011 4:09 pm

Dating dating free internet single site, dating north hyde park. Dating unalakleet.
Buddhist dating portland oregon. Dating asian wisconsin, dating rawson.
Black diaspora communities dating, free single dating. Dating bokoshe.
No nonsense dating ronn elmore. Download templates speed dating, dating moss bluff.
Texas dating hanalei hawaii, 100 dating free free personals. Jamaican women dating sites.
emehanofeni
 
Posts: 4
Joined: Thu Dec 01, 2011 7:58 am
Location: United States

Bluetooth-enabled proximity dating service g4. Speed dating

Postby vastrarcogs on Fri Dec 02, 2011 4:11 pm

Free adult dating summerfield ohio, dating jolo. Dating description definitions.
10 dating tips jenna jameson. Society and teenage dating in britain, dating oakland city.
Dating chatawa, dating shattuckville. Free dating site for cell phone.
Overweight woman dating. Dating discreet uk, dating loving.
Dating background checks free, dating walthourville. Dating a tgirl.
vastrarcogs
 
Posts: 6
Joined: Thu Dec 01, 2011 7:57 am
Location: USA

Free online dating services adult christian. Dating gay uk u

Postby tokgeonobutle on Fri Dec 02, 2011 5:38 pm

100 free dating site for singles, miami online dating. Dating eagle rock.
Dating velarde. Hitwise dating sites, alabama dating.
Sex dating in temple louisiana, dating dongola. Sephardic dating.
Dating gift idea. Sumy dating, alabama dating sites.
Good dating rules for men, dating west brooklyn. Dating montgomery center.
tokgeonobutle
 
Posts: 3
Joined: Thu Dec 01, 2011 7:54 am
Location: America

Previous

Who is online

Users browsing this forum: No registered users and 0 guests