Username_null
Username_null

Reputation: 1315

Simple debugging query

I have a small issue actually getting variable to show - let alone how to figure out why my images are not uploading. On my form I have the following textarea -

<input type="file" name="imageNew" />

in the page to which this form is posted I have -

$imagetoshow = $_REQUEST['imageNew']; echo "the image is " + $imagetoshow; exit();

I simply cant see why this is displaying a "0"? What I think I need is for someone to point out the obvious to me - obvious to you, not to me. Then I can get on with figuring out why the file isn't uploading.

Thanks in advance.

Upvotes: 0

Views: 34

Answers (2)

Fosco
Fosco

Reputation: 38506

Files work a little differently... You need to access the $_FILES superglobal.

http://www.php.net/manual/en/features.file-upload.post-method.php

(From that page as well: Note: Be sure your file upload form has attribute enctype="multipart/form-data" otherwise the file upload will not work.)

Upvotes: 2

rid
rid

Reputation: 63442

To get files, you need to use $_FILES, not $_POST, and the form needs to have enctype="multipart/form-data". Check out the following link for more about file uploads in PHP: http://www.php.net/manual/en/features.file-upload.php

Upvotes: 2

Related Questions