Solved

subdirectories in Amazon s3

Posted on 2006-11-29
5
725 Views
Last Modified: 2012-08-13
Has anyone written a function to create subdirectories for Amazon s3 in php?
I can make main directories no problem.
i.e. /myrootdir

What I am trying to do is make:
/myrootdir/subdir

I started with the php program at: http://www.neurofuzzy.net/2006/03/17/amazon-s3-php-class/
where you can download s3.class.php
and then I've written a small program to call the functions contained in the s3.class.php program.

Thanks in advance.

 
0
Comment
Question by:nhtahoe
  • 3
5 Comments
 
LVL 5

Accepted Solution

by:
dasmaer earned 500 total points
ID: 18041926
Hi nhtahoe

PHP comes with a handy utility called mkdir(): http://uk.php.net/mkdir - you can normally use this to make a diretcory.  Sometimes though this has been disabled.

You may be able to make directories by passing commands directly to the terminal though.  Try:

shell_exec("mkdir mydir");

or

exec("mkdir mydir");

There are a few ways to pass commands to the OS in PHP, start looking here and see what you come up with: http://uk.php.net/exec - follow links to similar methods for more details. Quite often one of these will be left open, so that you can upload an archive and then extract it... and a simple command like mkdir isn't likely to be blocked.

Hope this helps
0
 

Author Comment

by:nhtahoe
ID: 18042011
I have no problems creating/deleting sub directories on our server using php, very easy.
However,  I need to make them on the Amazon s3 server.
0
 

Author Comment

by:nhtahoe
ID: 18042059
Thanks for the suggestion, but that does not help with AMAZON S3 which is what I need help with.  I am well aware of the mkdir() function, but it doesn't work in S3.
0
 

Author Comment

by:nhtahoe
ID: 18042324
We figured out the answer on our own.  To create directories in S3 you simply create a file with the directory structure in the name.
0
 
LVL 3

Expert Comment

by:dereck2008
ID: 23640241
Yes, there is no folder object in S3. You need to create it yourself in the filename. It could lead to issues depending on third party tool you're using. JS3Explorer is a tool that allow to simulate folders and view flat S3 objects. It could be useful for troubleshooting:
http://www.jfileupload.com/products/js3explorer/index.html
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

Introduction Many web sites contain image galleries; a common design for these galleries includes a page with a collection of thumbnail images.  You can click on each of the thumbnail images to see the larger version of the image.  This is easily i…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will learn how to dynamically set the form action using jQuery.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now