Solved

Why the image is not echoed?

Posted on 2009-04-06
6
180 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.

733 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