Possible to create and write to a file on Dropbox via API? - php

Is it possible to create a file on Dropbox via the API and write to it directly? My current solution is to create a temp file locally, write to it, upload it and then remove the temp file.
I've only been able to find references on the Dropbox documentation to uploading files and not creating files, so I assume the above isn't possible, but would love to know if anyone has found a way.
Thanks in advance!

I don't understand what distinction you're drawing between "creating files" and "uploading files." You can certainly create/upload a file via the Dropbox API. See /files_put. Since you tagged this with PHP, the relevant methods in the official PHP SDK are uploadFile and uploadFileFromString.

Related

Intercept calls to folder on ubuntu and emulate folder behaviour

I have a big CRM system on PHP, which active works with users files, and stores them in the folder in the root of the project. Now i need to change system to save files on Amazon S3, but because of bad arhitecture of the system (it's an old open-source system) i cannot just rewrite the code. So, i got a little bit crazy idea, to intercept all system calls to one folder ("/var/www/%my_project%/uploads"), and process them in special way. PHP should be sure that it works with usual folder, file_put_contents and file_get_contents should work as usual, but in fact they should work with code which will serve files from S3 for them. Is that possible (how?), or it's too crazy idea?
Thanks :)
Amazon S3 Stream Wrapper helped me. It's needed just to create a client object, and call registerStreamWrapper method. That's all, now you can work with a folder "s3://yourbacketname" as with usual folder.

unzip or extract a file inside of dropbox using the php api

I'm working on a project with a friend and we would like to find a way to upload a .zip or .rar or .tar file to Dropbox, and then when the file is inside of Dropbox extract the files of that file. Everything must be done using the API.
Why we want to do this? Our project is a website builder and we already implement the Dropbox uploading of every single file and folders but we would like to speedup the process, creating a zip/rar/tar file, upload it to Dropbox and then extract the files to make it faster.
Is this possible?
No, Dropbox doesn't currently offer a way to remotely unzip uploaded zip, etc. files like this, so this isn't currently possible.

Updating S3 folder name using AWS sdk for PHP

I am working on the S3 bucket uploads and encountered an issue.I want to update the folder name inside one of my bucket.Went through the API here,but did not find a solution.
I would like to know if it is possible to achieve it or not?I would like experts over here to give inputs on it.
Thank you for your time.
Folders are not really folders in s3. They are just parts of the object key.
To "rename" the folder, you will need to rename all the objects inside the folder to include a different folder in its path.

Make the media uploader accept flash files

I am currently working with WordPress on a project and I need to allow the WordPress Media-Uploader.
I need to allow the upload of flash files since everytime I attempt to upload a flash file i get the following error: Sorry, this file type is not permitted for security reasons.
I tried to find within the doc but I couldnt find a place where it tell me how to allow flash files.
Could anyone point me in the right direction?
This is by design. To allow this you'll need to either change the core or install a plugin such as http://wordpress.org/plugins/mime-types-extended/.
There are other plugins here: http://wordpress.org/plugins/search.php?q=mime
Edit:
According to this tutorial, you can infact define additional mimetypes easily.

Amazon S3 folder manipulation with PHP

I have one instance in Amazon EC2. It is a Photobook. User can signup and upload images and they can create a photobook. S for that we want S3 storage. I searched a lot for a good PHP class to manipulate these folders, images and html files.
Now I have no idea how we can create folder, delete folder and search for a folder.
Can anyone help find a solution for these folder/image manipulation requirements like create , search, delete?
The official PHP SDK?
http://aws.amazon.com/sdkforphp/
http://aws.amazon.com/php/
Good question. I was trying to do it now and didn't found the answer in any documentation.
So I discovered that you just need to send the entire path in $keyname parameter:
folder/my_file_name.jpg
The S3 service can recognize and creates automatically the folders.
I think as me, you were looking for a method create_folder-like.
Easy and tricky.

Categories