I am working with a custom upload control which is working alright except that when I take my file and save it, the name is changing. That wouldn't matter only I don't know how it is being changed, so I can't save the correct filename as part of my record.
I can see that spaces are being replaced by "-" but of course I don't know what other changes are likely to occur and looking through the source for PhysicalFileSystem ( which I assume is where the file operations are performed? ) I can't see anything that is performing the name change.
The problem is that if my tempPath there is temp/ABC 123 DEF.pdf the file that the provider is creating will be called temp/abc-123-def.pdf. All I need to know is whether there is a method I can call to make sure that the record I am storing reflects the actual path that is created or - if there isn't - what changes are made during file path sanitisation.
Also I am aware that it would be conventional to create media items for this, but these files aren't media items from a structural perspective - in fact they get moved out of Umbraco's reach as part of this process - so I don't think in this case that would be a good approach.
I'm not sure but I think it's an internal method on the Mediaservice that handles this. It's great to have this since your original pages can have issues in various browsers. But what you can do is write your own datatype maybe that just stores the file in the format you like. A simple upload control will work I guess?
How does the MediaFileSystem rename files?
I am working with a custom upload control which is working alright except that when I take my file and save it, the name is changing. That wouldn't matter only I don't know how it is being changed, so I can't save the correct filename as part of my record.
I can see that spaces are being replaced by "-" but of course I don't know what other changes are likely to occur and looking through the source for PhysicalFileSystem ( which I assume is where the file operations are performed? ) I can't see anything that is performing the name change.
My code looks like this:
The problem is that if my tempPath there is
temp/ABC 123 DEF.pdf
the file that the provider is creating will be calledtemp/abc-123-def.pdf
. All I need to know is whether there is a method I can call to make sure that the record I am storing reflects the actual path that is created or - if there isn't - what changes are made during file path sanitisation.Also I am aware that it would be conventional to create media items for this, but these files aren't media items from a structural perspective - in fact they get moved out of Umbraco's reach as part of this process - so I don't think in this case that would be a good approach.
I'm not sure but I think it's an internal method on the Mediaservice that handles this. It's great to have this since your original pages can have issues in various browsers. But what you can do is write your own datatype maybe that just stores the file in the format you like. A simple upload control will work I guess?
Cheers,
Richard
is working on a reply...