How to Slim Framework Image Upload

Slim Framework is Micro Framework Similer to core php base. The Slim Framework doesn't have database functionality by default so you can just use core php for that.  And if you do not know how that works Follow Some code.

slim

Image Upload


$app->get("/upload", function () use ($app) {

   $app->view()->setData('username', null);
   $app->render('upload.php');


});


Image Upload Session Authentication:

$app->post("/upload",function () use ($app){
if(isset($_POST['submit']))
{
//$app->request()->$_FILES['picture']['name'];
echo $_FILES['picture']['name'];
echo $_FILES['picture']['size'];
$tmpname = $_FILES['picture']['tmp_name'];
$_SESSION['name'] = "img/".$_FILES['picture']['name'];
move_uploaded_file($tmpname,$_SESSION['name'] );
$uploaddir="/xampp/htdocs/OAuth/Slim/assets/img";
echo '<img src="'.$_SESSION['name'].'">';
}
});

How to Slim Framework Image Upload Developerinvention 5 of 5
Slim Framework is Micro Framework Similer to core php base. The Slim Framework doesn't have database functionality by default so you ca...

Share this

Related Posts

Previous
Next Post »

Xolo Offer