Not respecting file upload locations.
Posted: 03 December 2010 03:47 AM   [ Ignore ]
Wallflower
Rank
Total Posts:  6
Joined  2010-09-30

Hi,

First thanks for the great work on this fieldtype, it makes my life so much easier. Second, I’ve run into an issue on a new site that I’m building. I have one separate field where the client will upload a PDF, and below that I have a matrix field where the client will upload multiple images.

The two fields have separate file upload locations /uploads/boat-files/ and /uploads/boat-images/ respectively. For some strange reason when I fill these fields out, they’re all uploading to /boat-files/ if I upload a PDF. However if I only upload images and leave the PDF field alone they upload into /boat-images/

Do you have any idea why this would be happening? It looks like it’s taking the first file upload location and then using that for all Safecracker File fields on the rest of the publish page.

Happy to provide a login if that makes things easier.

Cheers

Profile
 
 
Posted: 03 December 2010 04:04 AM   [ Ignore ]   [ # 1 ]
Teen Scream
Avatar
RankRankRank
Total Posts:  3541
Joined  2009-05-29

Is this happening in the CP, SAEF, or both?

Profile
 
 
Posted: 03 December 2010 04:06 AM   [ Ignore ]   [ # 2 ]
Wallflower
Rank
Total Posts:  6
Joined  2010-09-30

Just in the CP, very early stages of building the site.

Profile
 
 
Posted: 03 December 2010 04:10 AM   [ Ignore ]   [ # 3 ]
Teen Scream
Avatar
RankRankRank
Total Posts:  3541
Joined  2009-05-29

I’ll do some tests here and get back to you.

Profile
 
 
Posted: 03 December 2010 04:13 AM   [ Ignore ]   [ # 4 ]
Wallflower
Rank
Total Posts:  6
Joined  2010-09-30

Thanks, appreciate the help. Let me know if you need a login.

Profile
 
 
Posted: 04 December 2010 04:25 AM   [ Ignore ]   [ # 5 ]
Teen Scream
Avatar
RankRankRank
Total Posts:  3541
Joined  2009-05-29

Hi Ben, I found a fix for this bug. If you could open up /system/expressionengine/third_party/safecracker_file/libraries/SC_Filemanager.php and add this function within the braces of the class definition:

function _upload_file($dir$field_name)
    {
        
if ($key array_search(BASEPATH.'libraries/Upload'.EXT$this->EE->load->_ci_loaded_files))
        
{
            
unset($this->EE->load->_ci_loaded_files[$key]);
        
}
        
        
return parent::_upload_file($dir$field_name);
    
Profile
 
 
Posted: 04 December 2010 05:21 AM   [ Ignore ]   [ # 6 ]
Wallflower
Rank
Total Posts:  6
Joined  2010-09-30

Thanks for your help.

My first test didn’t seem to work, but second try seemed to work fine, so I’ll keep an eye on it. Thanks again.

Profile