Solved

Why the image is not echoed?

Posted on 2009-04-06
6
173 Views
Last Modified: 2012-05-06
here image is not shown why ?

<?php
echo $_POST['image'];
?>

<form action="1.php" method="post" name="form"  enctype="multipart/form-data">
<input type="file" name="image" id="image" />
<input type="submit">
</form>
0
Comment
Question by:designersx
  • 3
  • 2
6 Comments
 
LVL 8

Expert Comment

by:mostart
ID: 24077072
because file uploads are handled by other POST variables:

try to echo these:

$_FILES['image']['name'] <- filename on client machine
$_FILES['image']['type']  <- mime-type
$_FILES['image']['size'] <- size
$_FILES['imgae']['tmp_name'] <- name on server

more info here:

http://de.php.net/manual/en/features.file-upload.post-method.php
0
 
LVL 14

Expert Comment

by:shobinsun
ID: 24077083
Use :

<?php
echo $_FILES['image'];
?>

<form action="1.php" method="post" name="form"  enctype="multipart/form-data">
<input type="file" name="image" id="image" />
<input type="submit">
</form>
0
 
LVL 14

Accepted Solution

by:
shobinsun earned 50 total points
ID: 24077128
Hello,

Use for printing the name of the file:

<?php
echo $_FILES['image']['name'];
?>

<form action="1.php" method="post" name="form"  enctype="multipart/form-data">
<input type="file" name="image" id="image" />
<input type="submit">
</form>
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 14

Expert Comment

by:shobinsun
ID: 24077210
Hello,

<?php
$source = $_FILES['image']['name'];
$target = './'.$_FILES['image']['name'];
move_uploaded_file($source, $target);

echo "image: <img src='./".$target."'><br>";

?>

To display the image that you have uploaded

Regards.
0
 

Author Comment

by:designersx
ID: 24084035
ok thanks.
0
 
LVL 8

Expert Comment

by:mostart
ID: 24085498
oh come on this is not fair. I was the first who answered and I gave you the same and even some additional information. The answer you accepted did only repeat parts of what I already wrote before, so at least you could split the points.
Its not fun helping people if they act like this, don't you think so ?
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

These days socially coordinated efforts have turned into a critical requirement for enterprises.
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to count occurrences of each item in an array.

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now