Handling POST data

52 views
Skip to first unread message

Victor S

unread,
Sep 5, 2010, 12:21:43 PM9/5/10
to GluePHP
Hello,

I like this little Glue thing, its proven very useful with GET
requests. But I have a form that uploads a file and I want to know how
to handle it using the Glue lib.

This is the relevant bit in index.php

class upload_test {
function GET() {
require_once('upload_test.php');
}
function POST() {
var_dump($_POST);
//echo($_POST['file']);
}
}

and the upload_test.php file is simply the HTML form.

<!DOCTYPE html>
<head>
<title>Form upload and resizing test</title>
</head>
<body>
<form method="post" action="/upload_test" enctype="multipart/form-
data">
<input type="file" name="file" />
<input type="submit" value="Upload" />
</form>
</body>
</html>

Any help appreciated!

Victor S

unread,
Sep 5, 2010, 4:34:41 PM9/5/10
to GluePHP
Actually I just found out that for file uploads you need to use PHP's
$_FILES superglobal not $_POST.

Cheerios...

Hey, when is the Glue.php website going to get some examples on how to
use it. I would be curious about to see how to properly combine
glue.php with php-unit and smarty. I have already used it with smarty,
but I am wondering what best practices can be used to put together a
kick ass stack for MVC development...

Yea, so I definitely changed the topic of this post.

- V

Joe

unread,
Sep 6, 2010, 12:17:06 AM9/6/10
to GluePHP
> Actually I just found out that for file uploads you need to use PHP's
> $_FILES superglobal not $_POST.

Good deal.

> Hey, when is the Glue.php website going to get some examples on how to
> use it. I would be curious about to see how to properly combine
> glue.php with php-unit and smarty. I have already used it with smarty,
> but I am wondering what best practices can be used to put together a
> kick ass stack for MVC development...

I'd like to get more documentation, examples, and recipes posted, but
truthfully I just haven't written anything as of yet. I haven't had to
use Glue for any projects lately or else I would have turned the
project outline into some type of case study.

The only piece of documentation that isn't posted on the main
gluephp.com page is "Glue and Smarty" (http://gluephp.com/
glueandsmarty.html). The methods outlined in that piece should be
easily transferrable to Twig.

I would be glad to post user-written documentation to the site if
anything is submitted.

Thanks,
Joe
Reply all
Reply to author
Forward
0 new messages