For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > October 2006 > request help with image upload









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author request help with image upload
Marnok.com

2006-10-12, 6:59 pm

Hi

I am trying to create a script to upload an image.

There are 2 php files : g_input.php and g_upload.php

g_input.php has a <form> which allows me to browse for an image, enter a
title, description etc.

The form action is "g_upload.php"

g_upload.php echoes the title and description just fine, but won't do a
thing with the image file. I tested with

isset($_POST['imagefile'])

and it is not set.

Presumably there is "something else" I have to do to make this actually
happen, but I've baffled myself by reading too many tutorials / examples /
descriptions. I am probably overloking something obvious I need to do -can
anyone tell me what it is?

Thanks

~Marnok


Rik

2006-10-12, 6:59 pm

Marnok.com wrote:
> Hi
>
> I am trying to create a script to upload an image.
>
> There are 2 php files : g_input.php and g_upload.php
>
> g_input.php has a <form> which allows me to browse for an image,
> enter a title, description etc.
>
> The form action is "g_upload.php"
>
> g_upload.php echoes the title and description just fine, but won't do
> a thing with the image file. I tested with
>
> isset($_POST['imagefile'])
>
> and it is not set.
>
> Presumably there is "something else" I have to do to make this
> actually happen, but I've baffled myself by reading too many
> tutorials / examples / descriptions. I am probably overloking
> something obvious I need to do -can anyone tell me what it is?


1. Enctype your form correctly.
2. $_FILES instead of $_POST.

Grtz,
--
Rik Wasmus


Marnok.com

2006-10-12, 6:59 pm


"Rik" <luiheidsgoeroe@hotmail.com> wrote in message
news:d746a$452e44c9$8259c69c$11748@news1
.tudelft.nl...
> Marnok.com wrote:
>
> 1. Enctype your form correctly.
> 2. $_FILES instead of $_POST.
>
> Grtz,
> --
> Rik Wasmus
>
>



Thanks! Looks like point 2 was it. You have saved me a headache.


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com