I've use Noerd's multifileupload package and it works great locally. Now it's been deployed to the live server, and I upload a few images but it saves them as regular files and not with the image media type.
Looking at the source code, the GetMediaFactory method finds the file's extension (in this case both .jpg and .png) and looks in /config/MultiFileUpload.config to figure out if it should launch the ImageMediaFactory or the FileMediaFactory.
Apparently, the FileMediaFactory is chosen, but I have no idea why. Permissions to the /config files must be fine, else I would get an error saying that the config file was not accessible.
It's an IIS6 server though and I'm thinking that might have something to do with the problem, could it be that the XmlReader in GetMediaFactory is different on IIS6? If, from the config file, there are no results, GetMediaFactory will choose the default which is the ImageMediaFactory. So it must get the wrong result from the config file..
Problem is: I don't have access to the server to check anything. Also, I have the "works on my machine" problem. Anything I can do about this?
For now, I've just changed my XSLT's to get both image and file mediatypes, but I can't use the width and height now.
Unfortunately I don't have a lot of access. And it's not an important enough issue to start a support ticket for at the moment.
Since this is a live site, I also don't want to go install logviewers, you never know what could happen.
Do you have an IIS6 machine? I don't have access to a test environment, so it's currently impossible to reproduce as well :(
I did notice that the config file looks like this, with the wildcard preceding the image definitions.. maybe I should change the order of those entries so that DefaultImageMediaFactory os the first one? But then.. why would it work on my machine and not on the server?
<?xml version="1.0" encoding="utf-8" ?>
<multipleFileUpload
xmlns='urn:MultipleFileUpload-schema'>
<mediaFacory assembly="noerd.Umb.DataTypes.multipleFileUpload" namespace="noerd.Umb.DataTypes.multipleFileUpload" type="DefaultFileMediaFactory">
<extensions>
<!-- <ext>*</ext> below is a wildcard and specifies that this MediaFactory
will be used if no other MediaFactory has a matching extension.
If multible MediaFactories is configured with a <ext>*</ext> the first MediaFactory
in document order will be use-->
<ext>*</ext>
</extensions>
</mediaFacory>
<mediaFacory assembly="noerd.Umb.DataTypes.multipleFileUpload" namespace="noerd.Umb.DataTypes.multipleFileUpload" type="DefaultImageMediaFactory">
<extensions>
<ext>jpeg</ext>
<ext>jpg</ext>
<ext>gif</ext>
<ext>bmp</ext>
<ext>png</ext>
<ext>tiff</ext>
<ext>tif</ext>
</extensions>
</mediaFacory>
</multipleFileUpload>
I think there may actually be an issue in loading the XML, as I'm pretty sure, by default it will fall back to the FileMediaFactory (this is hard coded, so doesn't get read from the config file) which would suggest something went wrong with the XML.
Unfortunatley I don't have an IIS 6 machine either anymore without setting up a VPC
Same here, don't want to set up a whole VPC for this.. ;-)
You are correct sir! The default is a file not an image, in my other project I have already changed this default, I probably had the same problem there, interesting...
Comments say:
// No config
// No matching extension
// No default media factory configured
Could it still be a permissions problem? I've renamed the config file on my local machine and it just throws an exception. I'll try turning of read permissions..
Probably is an issue with parsing then, whether the MSXML versions are the same? You really could do with getting at the log. Could you install one of the log file reader packages to check via umbraco?
MultiFileUpload gets wrong media type
I've use Noerd's multifileupload package and it works great locally. Now it's been deployed to the live server, and I upload a few images but it saves them as regular files and not with the image media type.
Looking at the source code, the GetMediaFactory method finds the file's extension (in this case both .jpg and .png) and looks in /config/MultiFileUpload.config to figure out if it should launch the ImageMediaFactory or the FileMediaFactory.
Apparently, the FileMediaFactory is chosen, but I have no idea why. Permissions to the /config files must be fine, else I would get an error saying that the config file was not accessible.
It's an IIS6 server though and I'm thinking that might have something to do with the problem, could it be that the XmlReader in GetMediaFactory is different on IIS6? If, from the config file, there are no results, GetMediaFactory will choose the default which is the ImageMediaFactory. So it must get the wrong result from the config file..
Problem is: I don't have access to the server to check anything. Also, I have the "works on my machine" problem. Anything I can do about this?
For now, I've just changed my XSLT's to get both image and file mediatypes, but I can't use the width and height now.
Hey Sebastiaan,
Do you have access to the DB? I'm pretty sure MFU does a fair bit of log writing so you may want to check the umbracoLog for any entries.
Would be interested to know as this is the same method used in DMU.
Matt
Unfortunately I don't have a lot of access. And it's not an important enough issue to start a support ticket for at the moment.
Since this is a live site, I also don't want to go install logviewers, you never know what could happen.
Do you have an IIS6 machine? I don't have access to a test environment, so it's currently impossible to reproduce as well :(
I did notice that the config file looks like this, with the wildcard preceding the image definitions.. maybe I should change the order of those entries so that DefaultImageMediaFactory os the first one? But then.. why would it work on my machine and not on the server?
I think there may actually be an issue in loading the XML, as I'm pretty sure, by default it will fall back to the FileMediaFactory (this is hard coded, so doesn't get read from the config file) which would suggest something went wrong with the XML.
Unfortunatley I don't have an IIS 6 machine either anymore without setting up a VPC
Matt
Same here, don't want to set up a whole VPC for this.. ;-)
You are correct sir! The default is a file not an image, in my other project I have already changed this default, I probably had the same problem there, interesting...
Comments say:
Could it still be a permissions problem? I've renamed the config file on my local machine and it just throws an exception. I'll try turning of read permissions..
Neh, not a permissions problem, when I deny read access I get an exception:
Access to the path 'D:\Dev\Project\UmbracoFramework\config\multiplefileupload.config' is denied.
Probably is an issue with parsing then, whether the MSXML versions are the same? You really could do with getting at the log. Could you install one of the log file reader packages to check via umbraco?
Matt
is working on a reply...