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
value="$article_foto"> field to preserve the value of the field:
Well. I discover that if I not have anything in the field
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:
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
Re: Image problem with $_FILES and $_POST
am 29.12.2007 15:54:24 von Jerry Stuckle
Karl wrote:
> 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
> value="$article_foto"> field to preserve the value of the field:
>
>
> Well. I discover that if I not have anything in the field
> 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
>
Do you have the image file name in a tag?
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Re: Image problem with $_FILES and $_POST
am 29.12.2007 16:02:45 von Karl
On 29 Des, 15:54, Jerry Stuckle wrote:
> Karl wrote:
> > 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
> > value="$article_foto"> field to preserve the value of the field:
> >
>
> > Well. I discover that if I not have anything in the field
> > 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
>
> Do you have the image file name in a tag?
>
Yes, I have.
And it works if I use the
field.
$article_photo = $_FILES["article_photo"]; make it work.
But when I have the image.jpg registred in a
field, it does not work.
I think that this hidden field use the $_POST["article_photo"]
instead of $_FILES["article_photo"] because if i "comment out" the
$_FILES... line and insted use $_POST["article_photo"] I can find it..
But then the file field not work..
Karl
Re: Image problem with $_FILES and $_POST
am 29.12.2007 19:51:30 von Jerry Stuckle
Karl wrote:
> On 29 Des, 15:54, Jerry Stuckle wrote:
>> Karl wrote:
>>> 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
>>> value="$article_foto"> field to preserve the value of the field:
>>>
>>> Well. I discover that if I not have anything in the field
>>> 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
>> Do you have the image file name in a tag?
>>
>
> Yes, I have.
>
> And it works if I use the
> field.
> $article_photo = $_FILES["article_photo"]; make it work.
> But when I have the image.jpg registred in a
> field, it does not work.
>
> I think that this hidden field use the $_POST["article_photo"]
> instead of $_FILES["article_photo"] because if i "comment out" the
> $_FILES... line and insted use $_POST["article_photo"] I can find it..
> But then the file field not work..
>
> Karl
>
OK, did you write this yourself? Or is this someone else's script?
If the latter, that's who you should be asking.
And and have two
entirely different uses.
And sure - if you comment out the $_FILES line, there is no way for the
file field will work.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
Re: Image problem with $_FILES and $_POST
am 29.12.2007 21:16:17 von Karl
On 29 Des, 19:51, Jerry Stuckle wrote:
>
> OK, did you write this yourself? Or is this someone else's script?
No it's mine :)
>
> If the latter, that's who you should be asking.
>
> And and have two
> entirely different uses.
>
Yes, I know.
> And sure - if you comment out the $_FILES line, there is no way for the
> file field will work.
Yes, of course. I do it just to try what would happen.
Anyway. If I select to post the image.jpg by the file field on the
"edit" page. It work.
I had hoped to find a way to "transfer" it through this different view
of forms without post it a second time.
Karl
Re: Image problem with $_FILES and $_POST
am 29.12.2007 21:38:58 von Jerry Stuckle
Karl wrote:
> On 29 Des, 19:51, Jerry Stuckle wrote:
>> OK, did you write this yourself? Or is this someone else's script?
>
> No it's mine :)
>
>> If the latter, that's who you should be asking.
>>
>> And and have two
>> entirely different uses.
>>
> Yes, I know.
>
>> And sure - if you comment out the $_FILES line, there is no way for the
>> file field will work.
>
> Yes, of course. I do it just to try what would happen.
>
> Anyway. If I select to post the image.jpg by the file field on the
> "edit" page. It work.
> I had hoped to find a way to "transfer" it through this different view
> of forms without post it a second time.
>
> Karl
>
OK, this is a little more clear now.
The only way you can get data from one page to another is either via a
form field or the $_SESSION variable.
In a case like this, I'd just use the hidden field to pass the old name.
If the user uploads a new file, use it. Otherwise just use the old
file (the one passed in the hidden field).
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================