Posts by Caleb • 67 points
5 posts
-
3
votes2
answers1284
viewsQ: How do I check whether the php_fileinfo.dll extension is active or not via php code?
I would need to run this code on another machine, in case the extension: extension=php_fileinfo.dll I need it to use the mimetype, if disabled I would use another code without using mimetype to make…
-
0
votes2
answers1493
viewsQ: How to Validate Only Jpeg as File Upload Extension?
I’m a beginner in programming. public function upload(){ if(Input::hasFile('file')){ $novonome = uniqid() . '.jpeg'; $file = Input::file('file'); $file->move('uploads',$novonome); return 'Anexado…
-
0
votes1
answer70
viewsQ: How to generate random names for images that will be uploaded?
I’m having trouble creating random names for my images. It was using the md5(mt_rand(1,10000) function but was unsuccessful using it in conjunction with has::file. public function anexar () {…
-
-2
votes1
answer131
viewsQ: How to use Try catch to handle id variable error in Findorfail
public function finalizarCompra () { try { $compra = Compra::findOrFail($compra->id); } catch(ModelNotFoundException $e){ return "erro"; } }
-
3
votes1
answer278
viewsQ: How to create a json from my object?
I have a Product object that I can’t turn into json using json_encode: <?php class Produto { public $nome; public $preco; public $descricao; function transformarJson(){ } } ?> How can I do…