Solved

Why the image is not echoed?

Posted on 2009-04-06
6
181 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
Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

 
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

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
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.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

691 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