Solved

Why the image is not echoed?

Posted on 2009-04-06
6
171 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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

707 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

19 Experts available now in Live!

Get 1:1 Help Now