Site icon Web Niraj

Parse.com: Uploading a File Using the Parse PHP SDK (v1.0.x)

Using the official Parse PHP SDK, it’s quite easy to upload a file to Parse. I’ve received a few requests for a tutorial to cover this particular issue, so here it is. I’ve used Parse PHP SDK v1.0.4 for this tutorial, but it will work with older versions too.

Using a simple HTML form and a few lines of PHP, you can upload a file to Parse. As we’re using PHP, the file is first uploaded to your server (in temporary space) and then sent to Parse.

When you create your Parse Class, make sure one column is of type File. In my example, the class TestObject has two columns: foo of type String, and image of type File.

The Code:

See the gist on github.

The Output:

After selecting a file to upload and submitting it, the above code will output the objectId of the saved object, and the link to the uploaded file:

In Parse, the class should show the uploaded file too (in my example, under the image column). You can click on the file name here to show the uploaded file too.

If you experience any issues with the above code, please let me know in the comment section below.

Exit mobile version