Jump to content

[SOLVED] what should i do with file ( $_POST['image'] ) ??


Recommended Posts

Hi yami007,

 

You can't check for a file upload with the $_POST parameter, use is_uploaded_file instead and/or $_FILES instead.

 

http://us3.php.net/manual/en/function.is-uploaded-file.php

http://us.php.net/manual/en/reserved.variables.files.php

 

Hope this helps.

file uploads are stored in the $_FILES superglobal... (instead of $_POST)

 

it looked like this on the inside

The format of this array is (assuming your form has two input type=file fields named "file1", "file2", etc):

 

Array

(

    [file1] => Array

        (

            [name] => MyFile.txt (comes from the browser, so treat as tainted)

            [type] => text/plain  (not sure where it gets this from - assume the browser, so treat as tainted)

            [tmp_name] => /tmp/php/php1h4j1o (could be anywhere on your system, depending on your config settings, but the user has no control, so this isn't tainted)

            [error] => UPLOAD_ERR_OK  (= 0)

            => 123  (the size in bytes)

        )

 

    [file2] => Array

        (

            [name] => MyFile.jpg

            [type] => image/jpeg

            [tmp_name] => /tmp/php/php6hst32

            [error] => UPLOAD_ERR_OK

            => 98174

        )

)

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.