Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,151,054 members, 7,810,939 topics. Date: Saturday, 27 April 2024 at 06:54 PM

Phpmyadmin And Dreamweaver8 Uploading Picture Issues - Webmasters - Nairaland

Nairaland Forum / Science/Technology / Webmasters / Phpmyadmin And Dreamweaver8 Uploading Picture Issues (5944 Views)

Help Phpmyadmin Showing My Blank In Wamp. / Trouble Loging Into My Phpmyadmin Cpanel With Syskay Hosting Company / Tutorials On How To Use Phpmyadmin In Your Website Cpanel (2) (3) (4)

(1) (Reply) (Go Down)

Phpmyadmin And Dreamweaver8 Uploading Picture Issues by pholusho(m): 10:54am On Dec 03, 2008
hello yah all, am having this little problem, i created this page which as a file field component i intend to use it for uploading pictures to my database, but when i tried it i did not submit to the database at all but i have been able to submit text to the database.please bear in mind that i make use of php my admin and macromedia dreamweaver(dont know php codes that much, but can use echo lol grin ). Please kindly help me out thank you.
Re: Phpmyadmin And Dreamweaver8 Uploading Picture Issues by smartsoft(m): 11:52am On Dec 03, 2008
there is a whole lot, when talking about dumping images to your database, you must create a temp file on your server and emmmmmmmmmmmmmmm hang brb,
Re: Phpmyadmin And Dreamweaver8 Uploading Picture Issues by pholusho(m): 7:52pm On Dec 06, 2008
still no solutions yet,
Re: Phpmyadmin And Dreamweaver8 Uploading Picture Issues by pholusho(m): 9:28pm On Dec 06, 2008
please dont tell me nobody as a clue about this
Re: Phpmyadmin And Dreamweaver8 Uploading Picture Issues by yawatide(f): 12:23am On Dec 07, 2008
I would have a clue if you didn't use a DW component so sorry, but I can't help you on this.

Possible issue: The type of data type specified for the image column (I blv it shd be BLOB)
Re: Phpmyadmin And Dreamweaver8 Uploading Picture Issues by pholusho(m): 8:17am On Dec 07, 2008
Thanks yawatide, you mean i should specify my data type on to be blob, believe me i have done that but dreamweaver would not just submit it to the database, what do i do now,
Re: Phpmyadmin And Dreamweaver8 Uploading Picture Issues by yawatide(f): 1:41pm On Dec 07, 2008
I am sorry but like I said, I don't use DW. As a matter of fact, I loathe it with a passion. Hopefully some DW users in here will help you out.
Re: Phpmyadmin And Dreamweaver8 Uploading Picture Issues by uspry1(f): 2:19pm On Dec 07, 2008
I hope you do know how to set up MySQL connection using Dreamweaver 8 like this link tutorial below:

http://www.nebulex.com/index.php?option=com_content&view=article&id=6&Itemid=62

Then you create your own dynamic form using Dreamweaver recordset to upload pictures into MySQL database for STORING or RETRIEVING purpose. You will need Dreamweaver extension (component) called PHP Upload from Adobe.com or below link from DMXzone.com:

http://www.dmxzone.com/showDetail.asp?TypeId=25&NewsId=6346

Basically you should know how to use PHP, MySQL and Dreamweaver recordset to make Picture upload work. There are few Dreamweaver database with upload picture tutorials found on books as well as Adobe.com.

Good luck!
Re: Phpmyadmin And Dreamweaver8 Uploading Picture Issues by kehers(m): 2:35pm On Dec 07, 2008
To start wit, it is not advisable to store up images in ur db fields. Store it in a folder snd store the imae path in the db instead.
Attached is a snippet for that

<?php
if(move_uploaded_file($_FILES['source']['tmp_name'], "foldername/".$_FILES['source']['name'])){
//query
$r = mysql_query("insert into tableName (src, size) values ('".$_FILES['source']['name']."', '".round($_FILES['source']['size']/1024."')"wink;
if($r){
//upload success
}
else{
//sql query error
//echo mysql_error();
}
}
else{
//Upload error
}
?>
And if you must store it in a db, simply make the data type f the field blob (binary large object - if Im correct) as Yawa said and once u upload, use any of the php file functions to read the content (binary) and it is that u insert into the db. Here is a simpel analogy:

<?php
$filecontent = file_get_contents('path/to/uploaded/file.ext');
$sql = "insert into tbl (px) values ('$filecontent')";
//, the query and otherthings follows
?>
Re: Phpmyadmin And Dreamweaver8 Uploading Picture Issues by pholusho(m): 8:42am On Dec 08, 2008
uspry1 thanks for your advice, but you see i know how to connect to the database, insert records to my database, but i tried usin the file field but it is not just working i tried connecting it the same way you connect a text input field and also made sure i specified blob for data type when i tested it on my browser it did not submit an error message comes up like field cannot be null. i will also check on the links you dropped and i'll come and give you a feed back chao. @all thanks for your opinions too.
Re: Phpmyadmin And Dreamweaver8 Uploading Picture Issues by pholusho(m): 9:00am On Dec 08, 2008
yeah i tried the same process again now its submitting to the database showing [blob-null] but i cant see the pix it self so i tried creating a new page with a dynamic table which display the recordset from my database field picture but when i tried running it the picture didnt show. please what should i do.
Re: Phpmyadmin And Dreamweaver8 Uploading Picture Issues by kehers(m): 3:39pm On Dec 08, 2008
The null means no data is inserted in the field. Are u sure the image is uploaded in the first place?

<form action="" enctype="multipart/form-data" method="post">
<input type="hidden" name="MAX_FILE_SIZE" value="524280">
Picture source: <input type="file" name="source" />
<input type="submit" value="Upload" />
</form>
The MAX_FILE_SIZE parameter is important and should come before your input file. its value is the maximum bytes allowed (here it is set to around 5MB). Take note of the form enctype as well. For uploads, it should be set to multipart/form-data
Re: Phpmyadmin And Dreamweaver8 Uploading Picture Issues by kehers(m): 4:00pm On Dec 08, 2008
LAst post's edit. The MAX size specified there is 500KB and not MB.
That said, the next thing is handling the uploaded image. First, create a folder called tmp and then handle the submission this way

$err = array(
0=>"There is no error, the file uploaded with success",
1=>"The uploaded file exceeds the maximum upload filesize",
2=>"The uploaded file exceeds the maximum upload filesize",
3=>"The uploaded file was only partially uploaded",
4=>"No file was uploaded",
6=>"Missing a temporary folder"
);
if(move_uploaded_file($_FILES['source']['tmp_name'], "tmp/".$_FILES['source']['name'])){
$filecontent = file_get_contents("tmp/".$_FILES['source']['name']);
//query
$r = mysql_query("insert into tbl (src) values ('".mysql_escape_string($filecontent)."')"wink;
echo mysql_error();
}
else{
echo 'Upload Error: '.$err[$_FILES['source']['error']];
}
Re: Phpmyadmin And Dreamweaver8 Uploading Picture Issues by kehers(m): 4:13pm On Dec 08, 2008
Im hoping you have average skills in PHP and Mysql so Ive purposely left out some more detailed parts. And by the way, the create sql for the tbl table Im using here goes like this

CREATE TABLE `tbl` (
`id` int(11) NOT NULL auto_increment,
`src` blob NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM

So lets continue. With the form and upload probably taken care of. The last worry is displaying the image. You actually need a script that will take of the image display. Lets call it image.php. Here is what it will contain:

<?php
mysql_connect("localhost", "db_usrname", "db_password"wink;
mysql_select_db("ur_dbname"wink;
//
$id = $_GET['id'];
$r = mysql_query("select src from tbl where id='$id'"wink;
list($src) = mysql_fetch_array($r);
echo $src;
?>

So that from anywhere, u can simply call up any image stored in the tbl this way:


<img src="image.php?id=1" alt="Hmmm, " />

And thats all. The id of the needed image is simply passed to image.php where it is retrieved and the value of the blob field is outputted.
By the way, there may be better ways to achieve storing images in a database but this is the idea I have. Anyone with other ideas should please share.
Let me know if it works.
Re: Phpmyadmin And Dreamweaver8 Uploading Picture Issues by pholusho(m): 8:15pm On Dec 09, 2008
kehers you are really appreciated but you see i dont know codes that much so most of those things looks like magic to me is there know way that i could do this with dreamweaver without using codes?
Re: Phpmyadmin And Dreamweaver8 Uploading Picture Issues by kehers(m): 9:50pm On Dec 09, 2008
Sorry to burst ur bubbles but i dont do DW as well. We can only hope another developer in d house will help out on d DW part.
Re: Phpmyadmin And Dreamweaver8 Uploading Picture Issues by pholusho(m): 9:56pm On Dec 09, 2008
@kehers what software do you use?
Re: Phpmyadmin And Dreamweaver8 Uploading Picture Issues by kehers(m): 10:17pm On Dec 09, 2008
I code directly in Editplus (an editor like d notepad, notepad++, and co)
Re: Phpmyadmin And Dreamweaver8 Uploading Picture Issues by pholusho(m): 3:36pm On Dec 12, 2008
i have gotten my hands on a book on php and mysql i hope it helps, thank yall for you advice and support
Re: Phpmyadmin And Dreamweaver8 Uploading Picture Issues by uspry1(f): 9:04pm On Dec 13, 2008
@pholusho

You are more than welcome and wish you the best luck to work on php and MySQL using Dreamweaver 8.
Re: Phpmyadmin And Dreamweaver8 Uploading Picture Issues by yankitwizy(m): 10:30am On Dec 15, 2008
I do use dreamweaver and phpmyadmin as well and it is true that with dreamweaver you could do a lot of PHP stuff without writing one single code but the truth is to do this particular thing you want, you must write code. There are no two ways about it. If you don't write then you can't get this done.
Re: Phpmyadmin And Dreamweaver8 Uploading Picture Issues by pholusho(m): 2:29pm On Dec 16, 2008
thanks at all. now am onto coding it my self but note pad is just messing up, meaning when i write my php codes with note pad the browser don't display the desired ouput, but when i used the same codes in the code section of dreamweaver they work well what could be wrong?
Re: Phpmyadmin And Dreamweaver8 Uploading Picture Issues by yawatide(f): 3:29pm On Dec 16, 2008
How are you saving your files?

In notepad, if you don't select "all files" from the "save" or "save as" dropdown, your file will be saved like so, "flename.php.txt" so it is important that you select "all files" under the "file type" menu to preserve the .php extension. If you don't want to go that route, then enclose your file name in double quotes when you name it.

Hopefully, this solves your problem using notepad.
Re: Phpmyadmin And Dreamweaver8 Uploading Picture Issues by Nobody: 7:18pm On Dec 18, 2008
Kehers and yankitwizy has answered it all

Dreamweaver will not help you, you have to code it urself
Talking about notepad, for a newbie like you, i will advise you still use the code view of dreamweaver, set the enctype of the form to multipart/form-data
use kehers codes and you should be fine

However, i dont like storing my image in databases for some special reasons, but if thats what you want you will have to set the database column type to BLOB and note that blob does not require a character length

Kehers has posted all these already, so he might be able to help if you stil have problem
Re: Phpmyadmin And Dreamweaver8 Uploading Picture Issues by Nobody: 10:16pm On Dec 23, 2008
The interesting thing i find here is that, i was not the only person that hate DW, i have written a number of scripts, classes in javascript, php, and i have a whole lot of very useful libraries, and i achieved this without DW, and NotePad++ is my favorite editor.
Now i am tryin to go all ajax like my new subsite http://www.ds.mwebng.net uses alot of ajax stuffs, but if u are a DW person, u cant benefit from alot of stuffs, u must wait for DW to get there.
It is not just me, many professionals find it tough to do sophisticated coding in DW, it is more difficult that to handcode directly using classes and all that.
So it is either u are fully into DW or NOT! and i prefer NOT!
There are lots of free php uploader scripts online, just type it into google, integratin it into DW especially for a beginner can be quite tough!!
I guess that is why most people kept quiet, even i cannot post any code here to help you, and yet had u asked for how to upload images without reloading the page, i will post back codes to u, but again, they will not work easily with DW!
Re: Phpmyadmin And Dreamweaver8 Uploading Picture Issues by Nobody: 8:58pm On Dec 25, 2008
me i love dreamweaver ooo
Re: Phpmyadmin And Dreamweaver8 Uploading Picture Issues by Nobody: 9:24pm On Dec 28, 2008
And what is the hashbang #!/usr/bin/girl on your profile meant to do? open a door for girls or what?
Anyway, no problemo, carry go, i can use DW too but to a limited extent.
Re: Phpmyadmin And Dreamweaver8 Uploading Picture Issues by Nobody: 9:31pm On Dec 28, 2008
And what is the hashbang #!/usr/bin/girl on your profile meant to do? open a door for girls or what? it is obviously not perl unless maybe the cgi-bin directory has been changed to bin-girl or something.
Anyway, no problemo, carry go, i can use DW too but to a limited extent. Anyway, my script library is quite large and i can code quite fast.
We could do a competition some day, DW vs NP++ [but i will have access to my personal script library sha] - and we will see who will win - 1st prize - ehm?  one enterprise project [i mean a big project for a client - of course from the looser]!!
Re: Phpmyadmin And Dreamweaver8 Uploading Picture Issues by Nobody: 7:21pm On Dec 29, 2008
thats a perl path for use girls and dump them (Please don't ask me if i do it)

About DW, I see loads of advantages it has over many web authoring softwares out there

1. Has code coloring like others
2. with the assets panel, i can preview my images without having to drag them in to see which image is which, a time saver
3. Snippets panel allows me to save frequently used codes, so i just double click to have it in my script
3. I find the inbuilt FTP very useful in special situations, though i rely mostly on CuteFTP
4. Using DW's tools for generating code help build SECURE websites, This is best for beginners as they transition into being a pro, They have nothing to fear
5. the dreamweaver exchange allows you to install some ajax  extensions so you can build ajax sites right from dreamweaver
6. The design view allow preview, so you don't have to switch to the web browser at an initial stage of development
7. The code view gives you the flexibility of remaining a hardcore programmer that you want to be

So why shouldn't i love this baby
Re: Phpmyadmin And Dreamweaver8 Uploading Picture Issues by Nobody: 11:10pm On Dec 31, 2008
You are very correct about all that - DW is excellent - though some of us that all we do is coding and loads of it - though some times i do have to rely on it.
I still even use FRONTPAGE atimes to do image mapping - but now, i prefer to my mapping direct from macromedia fireworks - anyways i will like you guys to contribute to the thread i just started - it is on http://nl.mwebng.net/ - that is a redirection path to the thread here on nairaland - talking about dynamic website design featuring javascript, dom, ajax, css,

(1) (Reply)

7 Ad Networks To Make Money On Your Blog / How To Get Real Nigerian Twitter Followers / How Can You Make $20 A Day From Google Adsense With An Entertainment Blog?

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 47
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.