ZF-6648: Amazon S3 StreamWrapper - is_dir Funktion

Issue Type: New Feature Created: 2009-05-14T01:55:13.000+0000 Last Updated: 2012-01-09T21:33:03.000+0000 Status: Resolved Fix version(s): - 1.8.2 (27/May/09)

Reporter: vincent (vistahr) Assignee: Stanislav Malyshev (stas) Tags: - Zend_Service_Amazon

Related issues: Attachments:



ive tested the Amazon_S3 StreamWrapper and this works fine. But now, i would like to realize a direct Upload to the Amazon Storage, but to Upload a file, Zend_File checks the Destination Directory and this won´t work with the StreamWrapper.

$s3 = new Zend_Service_Amazon_S3(*****) $s3->registerStreamWrapper("s3"); [...] $adapter = new Zend_File_Transfer_Adapter_Http(); $adapter->setDestination('s3://test-test-f/'); ( The bucket exist, checked with S3Fox. I also grant all rights in the ACL to everyone. )

This throws an exception, that the destination is not a directory.

Did i make a mistake or it is not implemented yet ?


Posted by vincent (vistahr) on 2009-05-14T02:36:00.000+0000

I´ve found the Issue.

There is a Problem with the backslash in the "_getNamePart" function.

I cant use this: "is_dir('s3://test-test-f)" cause the index "path" is undefined.

But when i use this: "is_dir('s3://test-test-f/')" the function return 2 slashes. string(12) "test-test-f//" and url_stat wont work.

The main problem, that i cant use is_dir() is, thats the mode is not set. ($stat['mode'] = 0;)

Quote from cellog at php dot net 13-Apr-2005 04:45 :

"url_stat() must define mode, or is_file()/is_dir()/is_executable(), and any of those functions affected by clearstatcache() simply won't work. It's not documented, but directories must be a mode like 040777 (octal), and files a mode like 0100666. If you wish the file to be executable, use 7s instead of 6s. The last 3 digits are exactly the same thing as what you pass to chmod. 040000 defines a directory, and 0100000 defines a file. "

Posted by Matthew Weier O'Phinney (matthew) on 2009-05-14T05:25:33.000+0000

Assigning to Stas.

Posted by Stanislav Malyshev (stas) on 2009-05-14T13:15:04.000+0000

the slash issue should be already fixed and I've checked in the fix for is_dir issue.

Posted by Stephane Brillant (stephanebrillant) on 2012-01-09T21:33:03.000+0000

This is still an issue. It look like we are not able to directly upload to S3. * The url_stat() code to detect folder/bucket vs. file often mix up: ** Example : 's3://bucketName/subfolder/' result in a file mode 's3://bucketName/file' is converted to 'bucketName\file' which result in a folder mode because '/' is not the Windows DIRECTORY_SEPARATOR

So query return error 404 most of the time.

file_put_contents('s3://BucketName/SubFolder/item.html', $data); work correctly so i will manualy update the file until it is fixed.

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.