Jump to content

Recommended Posts

Hi,

 

I use a page to post a message on a bulletin board. When I send the POST to the next page which deals with the  process of saving the message, two variables get recognized but the third not. $name=$_POST['name']; and $message=$_POST['message']; get recognized but $image=$_POST['image']; not.

and I get the famous error Notice: Undefined index: image.

 

I don't see the difference between them.

<?php
$pageDisplay = '<form name="new_message" enctype="multipart/form-data" action="news/post.php" method="post"><p>Welcome <b>'. $logOptions_username . '</b> post your message here.<br></p>
<input type="hidden" name="post" value="yes">
<p>
Heading<br>
<input type="text" name="name" size="50">
</p>
<p>
Message<br>
<textarea name="message" rows="5" cols="50"></textarea>
</p>
<p>
Picture<br>
<input name="image" type="file"> [under construction]
</p>
<p>
<input type="submit" value=\'Post Message\'>
<input type="reset" value="Reset">
</p>
</form>';
?>

 

Marco

The uploaded file information will be available in the $_FILES array, not the $_POST array. I recommend that you read the file upload handling section of the php documentation - http://us2.php.net/manual/en/features.file-upload.php

But at that point the file still has to be uploaded. Just the path has been defined.

So I don't think there will be anything in the array.

 

Could I change the image into a string representing the path and send that to Post.php?

 

Marco

But at that point the file still has to be uploaded. Just the path has been defined.

So I don't think there will be anything in the array.

 

Could I change the image into a string representing the path and send that to Post.php?

 

Marco

what are you talking about?

Any information that is gathered using the "file" type input attribute is stored in the $_FILES array, this include the file name, size, tmp folder that it is stored in, etc...

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.