0

I'm using the Parse PHP SDK and trying to upload an image. The file successfully saves, however the URL for the file returned by the getUrl() ParseFile method returns a 403 forbidden when I try to view it. Viewing the file via the Parse data browser also returns a 403 error. I'm using Laravel, and have tried several different methods:

1) Upload the file to parse, save the object against the user and then access the File via the getURL() method:

$contents = Input::file('profile_picture');
$file = ParseFile::createFromData($contents, "profilePicture_".$contents->getClientOriginalName());
Auth::user()->set('profilePicture', $file);

// In My View
<img src="{{Auth::user()->get('profilePicture')->getUrl()}}"/>

The URL returned returns a 403 forbidden.

2) Upload the file to Parse and store the URL against the user

$contents = Input::file('profile_picture');
$file = ParseFile::createFromData($contents, "profilePicture_".$contents->getClientOriginalName());
Auth::user()->set('profilePicture', $file->getUrl());

// In My View
<img src="{{Auth::user()->get('profilePicture')}}"/>

I have also tried both the above using:

$file = ParseFile::createFromData($contents, "profilePicture".$contents->getClientOriginalExtension());

An example of the URL being returned looks like: http://files.parsetfss.com/2ed712aa-99d8-4df1-8100-a1f907042d43/tfss-37d8f8e3-b8fc-4980-8d45-4a24957a5dc0-profilePicturepong.jpg

ExoticChimp
  • 1,884
  • 1
  • 19
  • 37
  • 1
    I'm voting to close this question as off-topic because user answered own question, was just doing something wrong. – Fosco Apr 23 '15 at 17:56
  • 1
    self-answers are [OK](http://stackoverflow.com/help/self-answer) on stackoverflow -- And if we got rid of questions where OP "was just doing something wrong", then we'd have to remove very large sections of the site :-). The one exception to this is "simple typographical errors", but this isn't one of those... – mgilson Dec 03 '16 at 11:33

1 Answers1

0

It was actually a case of me using the wrong method. I should have been using createFromFile

ExoticChimp
  • 1,884
  • 1
  • 19
  • 37