Issue Details (XML | Word | Printable)

Key: ZF-6648
Type: New Feature New Feature
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Stanislav Malyshev
Reporter: vincent
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Google issue summary
Zend Framework

Amazon S3 StreamWrapper - is_dir Funktion

Created: 14/May/09 01:55 AM   Updated: 14/May/09 01:15 PM   Resolved: 14/May/09 01:15 PM
Return to search "Fixed in 1.5.1"
Component/s: Zend_Service_Amazon
Affects Version/s: 1.8.1
Fix Version/s: 1.8.2

Time Tracking:
Not Specified


 Description  « Hide

Hi,

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 ?



vincent added a comment - 14/May/09 02:36 AM

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. "


Matthew Weier O'Phinney added a comment - 14/May/09 05:25 AM

Assigning to Stas.


Stanislav Malyshev added a comment - 14/May/09 01:15 PM

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