a5storage_savefile Function
Syntax
Arguments
- connectionStringCharacter
Storage connection string with ::storage:: as a prefix.
- filenameCharacter
The name of the local file to save in storage. If set to "<BinaryData>", this function can be used to save a binary object instead. The binary data must be specified in the pDataIn parameter. It is strongly recommended that you use a5storage_saveData() to save binary data.
- itemNameCharacter
The name of the object in storage. You can can specify a logical folder by using forward slashes in the name. For example: "image/image1.jpg"
- mimeTypeCharacter
The mime type of the object. If you don't specify this property, the value can be inferred from the extension assigned to the itemName property.
- pResultPointer
Default = null_value(). An optional dot variable that you can pass in that will be populated with information about the object.
- pDataInBinary
Default = null_value(). A binary object containing data to save to file. This property is only used if filename is set to "<BinaryData>". It is strongly recommended that you use a5storage_saveData() to save binary data.
- flagSetReadPermissionLogical
Default = .f.. If set to .t., adds read access to the file for everyone.
- flagOverwriteExistingObjectLogical
Default = .t.. If .t., if an object already exists in the storage with the same name, the object is replaced by the uploaded file. Otherwise, the uploaded file is assigned a unique name. If the object is renamed and you pass in the optional pResult parameter, the actual object name that was used to save the new object is available in the pResult.actualItemName property.
Description
Saves a file to storage, including saving files to Amazon S3 or Azure
Example:
dim pr as p flag = a5Storage_saveFile("::storage::Amazon_East","c:\images\4290.jpg","movies/4290.jpg","",pr) ? flag = .T.
If you examine the pr dot variable that was passed into the function you will see the following properties:
hasError = .f. timeTakenMilliseconds = 239 AbsolutePath = "https://.s3.amazonaws.com/movies/4290.jpg" ContentType = "image/jpeg" ModifiedTime = CTODT('03/15/2014 01:53:13 00 pm') Name = "movies/4290.jpg" size = 5880
The AbsolutePath property gives you a URL to the object. Note that in order for this URL to work you need to make sure that you have set the appropriate permissions on the storage container ('bucket' in S3 terminology).
See Also