Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File Upload does not work #23

Closed
GoogleCodeExporter opened this issue Jul 16, 2015 · 4 comments
Closed

File Upload does not work #23

GoogleCodeExporter opened this issue Jul 16, 2015 · 4 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?

1.File Upload does not work

What is the expected output? What do you see instead?

I want to see the uploaded file name to be able to handle the file after
upload.
I see nothing in the $_POST variable.
The parameters for name and value are set.

(Last tried this string among others

$form->addFile("File:", "field13","$foobar=blubber", array("filename" =>
"File"));

)
I use the elements example page, and after submitting not even the value
"field13" is shown!


What version of the product are you using? On what operating system?
1.0 linux

Please provide any additional information below.

Please provide an example for the addFile function.


Original issue reported on code.google.com by rennradt...@googlemail.com on 13 Mar 2010 at 5:39

@GoogleCodeExporter
Copy link
Author

Files uploaded though html forms can be accessed in the $_FILES array, not the 
$_POST array.  When the form is submitted, try doing a print_r on the $_FILES 
array 
and you should see your file information.

Also, the addFile function only accepts three values following the format 
provided 
below...

function addFile($label, $name, $additionalParams="")

Please let me know if you have any additional questions and I will assist.

Thanks,
- Andrew

Original comment by ajporterfield@gmail.com on 13 Mar 2010 at 5:55

  • Changed state: Done

@GoogleCodeExporter
Copy link
Author

Hi. 
Kind greetings from Germany :-)

Thanks for this very very fast reply!

> Files uploaded though html forms can be accessed in the $_FILES array, not
> the $_POST array. 

Ah, ok. 
You should make a note in the example pages to point this out.

> When the form is submitted, try doing a print_r on the 
> $_FILES array
> and you should see your file information.

Nope. It still not work. 
>
> Also, the addFile function only accepts three values following the format
> provided
> below...
>
> function addFile($label, $name, $additionalParams="")

Ok then something is wrong.

When you look at the elements example page you see this.

After:

//Below you will find functions for adding each of the 18 supported form field 
types.
[..]
function addFile($label, $name, $value="", $additionalParams="")

> Please let me know if you have any additional questions and I will assist.

Here we go:

I have tried this:


$form->addFile("File:", "field13"));

And

       echo "The File Vars:";
        print_r($_FILE);
right after the print_r($_POST) statement.

Output is:

Array
(
    [cmd] => submit
    [field0] => 
    [field15] => 
    [field1] => Array
        (
            [0] => option0
            [1] => option1
            [2] => option2
        )

    [field3] => 
    [field4] => option0
    [field7] => 
    [field8] => 
    [field11] => 
    [field12] => 
    [field14] => 
    [field16] => 
    [field17] => <br />

    [field18] => 
    [recaptcha_challenge_field] => 
02B_JVQ7mkZhsEo5WVRd6Czk1I1oT-4jBsP-i1VY2YzO3ckyuO-EJyox8VgDBmlk08MIFpzB_YyLfehv
dZyOzZOZvRoOcXz_PTjd4KuqCU2uTQfdmc-Vw0S4jSIoxoXQ8Cdzu2I55_xC_6-cXD_AbDcIQuL7MkSI
y64Tzje82Jv9GnVHrmbLznqw0kbAWB2NF0jQz7dmdvpEVElDwhpFBGDy5MhWFvW36w81qwkNB7vrmCLo
gvTXWAiRL-WUZiuV8dp2P8xN-PEsSfyW6NrvFim1Gis2YB
    [recaptcha_response_field] => 
)

The File Vars:


^ as you can see, there is nothing to see :-)

What am I doing wrong?

Do you have an working example for me please?


Thanks in advance!

Ralf

Original comment by rennradt...@googlemail.com on 13 Mar 2010 at 7:46

@GoogleCodeExporter
Copy link
Author

Ralf,

Kind greetings to you from the US :)  In the code you provided above, I see you 
are 
doing...

print_r($_FILE);

You need to change this to...

print_r($_FILES);

php.net is a great site for all things php related.  Check out 
http://us2.php.net/manual/en/features.file-upload.post-method.php for more 
information and instruction on how file uploads are handled in php.

Thanks,
Andrew

Original comment by ajporterfield@gmail.com on 13 Mar 2010 at 7:57

@GoogleCodeExporter
Copy link
Author


Hi.

>In the code you provided above, I see  
>you are
>doing...

>print_r($_FILE);

>You need to change this to...

>print_r($_FILES);

Argl!! OK I'am stupid.

Sorry for the hassle!

But to mention the $_FILE thing in the examples would help a lot.

Thanks for the help and keep up  the good work, the form_class is really 
helpful!

Ralf  


Original comment by rennradt...@googlemail.com on 13 Mar 2010 at 8:19

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant