|Uploading file to SMEStorage|
In this post i will describe php sample that uploads file to SMEStorage (http://www.smestorage.com)
In previous post i wroute about how SMEStorage API works in general and creating of folder was described.
Now i will extend that sample and add function for uploading of the file.
This is test file code. There are 2 callings of uploadFile function. This function is described in lib.php file.
On first call of the uploadFile function the file angel1.jpg is uploaded to root folder of SMEStorage account. With 2-nd call the file angel2.jpg is uploaded to just created folder.
Body of function uploadFile
The function prepares list of arguments for POST request to the API server.
Take a look at argument 'file_1'=>'@'.$filepath .
@ - is directive for cUrl library that it is needed to include file by the path to POST request.
There is zip of the sample with described code - download
|Last Updated on Thursday, 18 February 2010 14:43|