This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use the new forum.
Home » support » General discussion » Meta types for admin_input_upload_tag with stable 0.6.3
Meta types for admin_input_upload_tag with stable 0.6.3 [message #14147] Thu, 19 October 2006 06:04 Go to next message
goslund  is currently offline goslund
Messages: 5
Registered: September 2006
Location: Colorado
Junior Member
Hi-
in my situation i have used the admin generator to generate a backend for all of the site administration things that I need in my site- I only have run into one problem so far:
I can't upload mp3s with the basic setup. I copied the code I used in my pictures area generator.yml file (which works fine with picture types).

Do I need a partial or do I need to define what meta types the admin section will accept?

Thanks,
Geoff
Re: Meta types for admin_input_upload_tag with stable 0.6.3 [message #14154 is a reply to message #14147 ] Thu, 19 October 2006 09:28 Go to previous messageGo to next message
goslund  is currently offline goslund
Messages: 5
Registered: September 2006
Location: Colorado
Junior Member
ok wrote a custom validator for it and everything's working for the most part -- it won't let me upload non-mp3s.
However now when the file is uploaded through the backend.php stuff, it saves the file as a .bin file and not as a .mp3 file.. any tips?
Re: Meta types for admin_input_upload_tag with stable 0.6.3 [message #16903 is a reply to message #14154 ] Thu, 30 November 2006 15:07 Go to previous messageGo to next message
flarian  is currently offline flarian
Messages: 37
Registered: November 2006
Member
Hello!

Hase anyone ever solved this problem? I've got he same one, I want to upload pdf-files...

Ralf
Re: Meta types for admin_input_upload_tag with stable 0.6.3 [message #16907 is a reply to message #14147 ] Thu, 30 November 2006 15:47 Go to previous message
flarian  is currently offline flarian
Messages: 37
Registered: November 2006
Member
Hello!

I am working on the same problem - "application/unknown" => bin instead of pdf...

Look an this: https://bugzilla.mozilla.org/show_bug.cgi?id=316143

It seems to me that firefox is causing the trouble.

More information: Have a look at sfWebRequest.class.php. There is the function getFileExtension($name), which should have a look at the mime type and find the correct file extension...

You could replace this methode by the following code, it works for me:

public function getFileExtension ($name)
  {
    $fileType = $this->getFileType($name);

    if (!$fileType) {
        return '.bin';
    }

    // mimetype has been found... Let's look for the file-extension
    $mimeTypes = unserialize(file_get_contents(sfConfig::get('sf_symfony_data_dir').'/data/mime_types.dat'));
    $fileEx = isset($mimeTypes[$fileType]) ? '.'.$mimeTypes[$fileType] : '.bin';

    // Special treatment to avoid Firefox's bugs
    if($fileEx == ".bin") {
        $fileAr = explode('.', $this->getFileName($name));
        $fileEx = '.' . $fileAr[count($fileAr) - 1];
        if($fileEx == ".php" || $fileEx == ".pl" || $fileEx == ".php3" || $fileEx == ".php4" ||
                $fileEx == ".php5" || $fileEx == ".htaccess" || $fileEx == ".phtml") {
            return '.bin';
        }
    }

    return $fileEx;
  }


Previous Topic:intermediate model layer in propel
Next Topic:moveFile() only moves jpeg files not mp3
Goto Forum:
  

powered by FUDforum - copyright ©2001-2004 FUD Forum Bulletin Board Software