Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

problems passing files from a form

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

problems passing files from a form

Postby sametch » Wed Feb 26, 2003 6:52 am

I am trying to pass a file from a form to another php page that will upload it.

Each time the variable passed end up being null.

The settings in my form are:

<form name="form1" method="post" action="upload.php" enctype="multipart/form-data">
<input type="file" name="pageimage">
<input type="submit" name="Submit" value="Submit">

The form works fine, I can browse to a file on my local machine and its filename/path are added in the text box.

But when I check the value of the variable $pageimage on the "upload.php" page it is NULL.

I am checking it thus:

$pageimage = $HTTP_POST_VARS['pageimage'];
echo "Image type is = ".gettype($pageimage);

Does anyone know why it may not be passing the value across?

New php-forum User
New php-forum User
Posts: 17
Joined: Wed Jul 03, 2002 3:10 am

Postby Oleg Butuzov » Wed Feb 26, 2003 7:35 am


Oleg Butuzov
Last Samuray
Last Samuray
Posts: 831
Joined: Sun Jun 02, 2002 3:09 am

Re: problems passing files from a form

Postby Redcircle » Wed Feb 26, 2003 11:22 am

sametch wrote:$pageimage = $HTTP_POST_VARS['pageimage'];
echo "Image type is = ".gettype($pageimage);

inorder to get the type you can use
Code: Select all
echo $_FILES['pageimage']['type'];

This will echo the mime type of the file.
User avatar
Posts: 830
Joined: Tue Jan 21, 2003 10:42 pm
Location: Michigan USA

Return to PHP coding => General

Who is online

Users browsing this forum: dendonpaul, Google Feedfetcher and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.