Files [parse.File]¶
File URIs
When you upload a file, Parse will return a special url pointing to your resource. Make sure you store or link it to an Object.
parse.upload()¶
Upload a file.
Important
This is a special method, it is accessed directly from the parse namespace, parse.upload( args )
. It is not a standard parse.request
.
Parameters
- filename.ext
- baseDirectory (optional, default:
system.DocumentsDirectory
)
The baseDirectory is the source directory where your file resides.
parse.upload( "filename.ext" )
:response()
You can also follow the progress of the upload:
parse.upload( "filename.ext", system.DocumentsDirectory ) :progress(function(ok, bytesTrans, bytesEst) if ok then print( bytesTrans, bytesEst) end end) :response(function( ok, res, info ) print('all done') parse.trace( res ) end)
parse.download()¶
Download a file.
Important
This is a special method, it is accessed directly from the parse namespace, parse.download( args )
. It is not a standard parse.request
.
Parameters
- parse_file_uri
- save_as_filename.ext
- baseDirectory (optional, default:
system.DocumentsDirectory
)
The baseDirectory is the destination directory of the download.
parse.download( "https://files.parsefss.com/...", "filename.ext" ) :response()
You can also follow the progress of the download:
parse.download( "https://files.parsefss.com/...", "filename.ext", system.DocumentsDirectory ) :progress(function(ok, bytesTrans, bytesEst) if ok then print( bytesTrans, bytesEst) end end) :response(function( ok, res, info ) print('all done') parse.trace( res ) end)
Linking files¶
See .linkFileToUser and .linkFileToObject
.delete¶
Delete a File.
- Parse provided file uri.
parse.request( parse.File.delete, "http://path-to-file" )
:response(cb)