I am doing a project where user can upload images like profile image or image for their image gallary. right now its uploading all the images to my server.
Now, i want to upload all this image to my rackspace cloud files directly using php script. For example:
so do u have any idea, exactly how i can do this?
i am using:
thanks in advance for any answer.
Update: Although the method that I describe below will still work, it is not possible to upload files directly using tokens (thanks to DesignerGuy for that info). You can read more about how to do that here. I should also mention that services like transloadit now make this sort of thing trivially easy using jquery inserts into HTML forms. Still the method that I describe below still works and probably gives you the most control.
You cannot load files -directly- to Rackspace Files, without trying something like embedding your Rackspace credentials into the form. Even if this were possible it would not be a good idea. (i.e. the user could add massive content using your credentials that have nothing to do with your application). So to get what you want, which is essentially to have the file stored at Rackspace, and the location of the file stored in your server you need to modify your work flow. It needs to be:
If you want the file to be publically downloadable...
If you want the file to be only downloadable by -certain- users....
You do not pay for bandwidth between -your server- and rackspace files, if -your server- is also a rackspace cloud instance or a regular Rackspace Managed Server (or at least that is what customer support has told me). An important fact when calculating the rates between Amazon and Rackspace.
So you can either use Rackspace Files as a massive hard-drive for your server, which gives you control over access, or you can use it as a massive public distribution network... But in both cases you might need to change the order of your steps to give you what you want...
You might also look at a simple example of using php to upload a file gathered from an HTML form to rackspace files.