laravel - Parse.com PHP SDK ParseFile Image 403 Forbidden -
i'm using parse php sdk , trying upload image. file saves, url file returned geturl() parsefile method returns 403 forbidden when try view it. viewing file via parse data browser returns 403 error. i'm using laravel, , have tried several different methods:
1) upload file parse, save object against user , access file via geturl() method:
$contents = input::file('profile_picture'); $file = parsefile::createfromdata($contents, "profilepicture_".$contents->getclientoriginalname()); auth::user()->set('profilepicture', $file); // in view <img src="{{auth::user()->get('profilepicture')->geturl()}}"/>
the url returned returns 403 forbidden.
2) upload file parse , store url against user
$contents = input::file('profile_picture'); $file = parsefile::createfromdata($contents, "profilepicture_".$contents->getclientoriginalname()); auth::user()->set('profilepicture', $file->geturl()); // in view <img src="{{auth::user()->get('profilepicture')}}"/>
i have tried both above using:
$file = parsefile::createfromdata($contents, "profilepicture".$contents->getclientoriginalextension());
an example of url being returned looks like: http://files.parsetfss.com/2ed712aa-99d8-4df1-8100-a1f907042d43/tfss-37d8f8e3-b8fc-4980-8d45-4a24957a5dc0-profilepicturepong.jpg
it case of me using wrong method. should have been using createfromfile
Comments
Post a Comment