We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,254 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

DOESNT WORK

<form action="index.php" method="post" enctype="multipart/form-data">
File: <input type="file" name="image"><input type="submit" value="Upload">
</form>
<?php
//connect to db
mysql_connect("localhost","root","")or die(mysql_error());
mysql_select_db ("databaseimage")or die (mysql_error());
@$file =$_FILES['image']['tmp_name'];//kjo eshte e lidhur me <input type="file" name="image"> 
if (!isset($file))
echo ("Please select an image");
else {
$image= addslashes(file_get_contents ($_FILES['image'] ['tmp_name']));
$image_name = addslashes($_FILES['image']['name']);
$image_size = getimagesize ($_FILES['image'] ['tmp_name']);
if(@$image_size==FALSE)
echo "Nuk eshte imazh ky or bir   hahahahah";
else
{
if(!$insert =mysql_query ("INSERT INTO store VALUES ('','$image_name','$image')"))
 echo ('Pati problem ne ngarkim');
 else {
 $lastid = mysql_insert_id ();
 echo "Image uploaded.<p />Your image:<p /><img src=get.php?id=$lastid>";
}
}
}
?>
3
Contributors
8
Replies
21 Hours
Discussion Span
6 Months Ago
Last Updated
9
Views
andyy121
Junior Poster
141 posts since Aug 2012
Reputation Points: -9
Solved Threads: 0
Skill Endorsements: 0
<?php
mysql_connect("localhost","root","")or die(mysql_error());
mysql_select_db ("databaseimage")or die (mysql_error());
$id = addslashes ($_REQUEST['id']);
$image = mysql_query ("SELECT * FROM store WHERE id=$id");
$image = mysql_fetch_assoc ($image);
$image = $image ['image'];
header ("Content-type:image/jpeg");
echo $image;
?>



when i click upload button id doesnt show the image i have fallow the youtube video and i can find my error iinside the code
can somebody help me
andyy121
Junior Poster
141 posts since Aug 2012
Reputation Points: -9
Solved Threads: 0
Skill Endorsements: 0

What are you trying to do: Explain in details what you are trying to do .

How are you trying to do it: Explain how you are trying to archive what ever you are trying to do.

Where is the problem / question: After the above two steps explain where is the problem you deal or the question you have.

jkon
Posting Whiz
383 posts since Jan 2009
Reputation Points: 124
Solved Threads: 63
Skill Endorsements: 4

I'll refer you to the forum sticky: http://www.daniweb.com/web-development/php/threads/435023/read-this-before-posting-a-question

Provide a meaningful title too.

diafol
Keep Smiling
Moderator
10,665 posts since Oct 2006
Reputation Points: 1,628
Solved Threads: 1,514
Skill Endorsements: 57

it is a upload code,when i chose the image i wont to upload it doesnt look like an image it look a litle icon

andyy121
Junior Poster
141 posts since Aug 2012
Reputation Points: -9
Solved Threads: 0
Skill Endorsements: 0

icon as in an icon of the image itself or a 'missing image icon'?

diafol
Keep Smiling
Moderator
10,665 posts since Oct 2006
Reputation Points: 1,628
Solved Threads: 1,514
Skill Endorsements: 57

Capture57

Attachments Capture.PNG 0.41KB
andyy121
Junior Poster
141 posts since Aug 2012
Reputation Points: -9
Solved Threads: 0
Skill Endorsements: 0

this is the image when i click upload button the image is in the desktop

andyy121
Junior Poster
141 posts since Aug 2012
Reputation Points: -9
Solved Threads: 0
Skill Endorsements: 0

have you seen the image i have uploaded??

andyy121
Junior Poster
141 posts since Aug 2012
Reputation Points: -9
Solved Threads: 0
Skill Endorsements: 0

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.0832 seconds using 2.73MB