File tree 1 file changed +14
-5
lines changed
1 file changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -1612,17 +1612,26 @@ protected function _getUploader()
1612
1612
}
1613
1613
1614
1614
/**
1615
- * @param $filePath
1615
+ * @param $fileName
1616
1616
* @return bool
1617
1617
*/
1618
1618
protected function moveDownloadableFile ($ fileName )
1619
1619
{
1620
- $ filePath = $ this ->_getUploader ()->getTmpDir () . $ fileName ;
1621
- $ destDir = Mage::getConfig ()->getOptions ()->getMediaDir () . '/downloadable/files/links ' . $ fileName ;
1622
-
1620
+ $ filePath = $ this ->_getUploader ()->getTmpDir () . $ fileName ;
1621
+ $ basePath = Mage::getModel ('downloadable/link ' )->getBasePath ();
1622
+ $ destDirectory = dirname (Mage::helper ('downloadable/file ' )->getFilePath ($ basePath , $ fileName ));
1623
+ // make sure that the destination directory exists!
1624
+ $ ioObject = new Varien_Io_File ();
1625
+ try {
1626
+ $ ioObject ->open (array ('path ' => $ destDirectory ));
1627
+ } catch (Exception $ e ) {
1628
+ $ ioObject ->mkdir ($ destDirectory , 0777 , true );
1629
+ $ ioObject ->open (array ('path ' => $ destDirectory ));
1630
+ }
1631
+ $ destFile = $ basePath . DS . $ fileName ;
1623
1632
$ sourceFile = realpath ($ filePath );
1624
1633
if ($ sourceFile !== false ) {
1625
- return copy ($ sourceFile , $ destDir );
1634
+ return copy ($ sourceFile , $ destFile );
1626
1635
} else {
1627
1636
return false ;
1628
1637
}
You can’t perform that action at this time.
0 commit comments