简体   繁体   中英

rackspace sub container not uploading file

I was using rackspace and while uploading files I wasn't able to create sub directories or container for thumbnail files. The reason i am not uploading is because i want to keep the files url as {someUrl}/{fileName} and for their thumbnails i want {someUrl}/thumbnails/{fileName}. So i did this

$ActualImage = file_get_contents($fileThumbPath);
$rackspace->storeObject('VAC', $fileName, $ActualImage,$this->getMataData($extension));

This works fine but when i do this

$thumbImage = file_get_contents($fileThumbPath);
    $rackspace->storeObject('VAC/thumbnails/', $fileName, $thumbImage ,$this->getMataData($extension));

How can i upload to subdirectories

In Zend framework 1 I was doing this

require_once('Rackspace/Cloudfiles.php');
$cf = new Rackspace_Cloudfiles(user,pass);
    $cf->putObject('VAC/thumbnails/' . $fileName, $thumbfileData);

and that works fine

Started a bounty because i really needed to implement this in zend framework 2 . I have two version of an application and in order to work them both they need to save the files on the same location. This nested file saving is really need guys...

In Rackspace containers there is no concept of sub directories, but they use virual directory system. So your file name should have sub directory structure.

Change your file name to - "/thumbnails/".$filename

$rackspace->storeObject('VAC', '/thumbnails/'.$fileName, $thumbImage ,$this->getMataData($extension));

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM