Reply to Image problem with $_FILES and $_POST

Your name:

Reply:


Posted by Karl on 12/29/07 14:25

Hello again.
I have a form for posting news articles.

Form one is the "register" form.
Then I go to the preview form were I can select edit or accept

If I select edit, I got the "edit form" and if I select accept, I
receive a message that say:

The news article "headline" are posted into the database.

When I use the file field and browse to "my photos", select an image
and post it. I can see it in the priview form/page and can also show
it in the article.

But if I select the "edit" button I can't see the image.
I am using <input type="hidden" name="article_photo"
value="$article_foto"> field to preserve the value of the field:
<input type="file" name="article_photo">

Well. I discover that if I not have anything in the field <input
type="file" name="article_photo"...
but still have the image.jpg in the hidden field. It use the
$_POST["article_photo"] insted of
$_FILES["article_photo"];

So I was thinking that this below should do the trick:

if(!isset($_FILES["article_photo"])){
$article_photo = $_POST["article_photo"];
} else {
$article_photo = $_FILES["article_photo"];
}

But still the image are not avaible in the edit or preview pages in
the variable $article_photo
BUT if I use the file field and browse, select an image and post it.
Then it show up in those pages.

How can I fix this? Is it better to use setcookie("article_photo",
$_POST['article_photo'] time()+30);

Thanks for all advice. (and sorry my weak english)

Karl

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация