Windows Live Writer overwriting uploaded files

February 13, 2009 at 10:52 PMAndre Loker

Weird, I didn’t notice it for quite some time. It seems that since version 2009 Windows Live Writer has changed they that uploaded (images etc) files are called. If you look at older posts you’ll see that the images were uploaded to /WindowsLiveWriter/{article name}_{some number}/image_{some number}.png the data folder of my blog. It seems that some smart guy decided to change this behaviour to something short as /{filename}. The blog overwrites this file if it exists so if you were to use the same file name in multiple articles you’d happily overwrite the older version with the new one.

This becomes even more unpleasant if you keep in mind that images that are pasted from the clipboard into WLW will all have the name “image.png”. Guess what: if you publish an article with multiple images pasted from the clipboard you’ll end up with all images being the same.

I hope that this is just some hidden setting in WLW, but until now I couldn’t find it.

Now, actually I did find something. After some time of searching I found a comment in another blog that at least provided an initial hint of how to work on this problem. You can change the format of uploaded file names with a registry key:

HKEY_CURRENT_USER\Software\Microsoft\Windows Live\Writer\Weblogs\(BLOGID)\UserOptionOverrides

where (BLOGID) is different for each blog registered in WLW. Within that key create a string value name fileUploadNameFormat and assign it a string representing the format of the uploaded files, for example WindowsLiveWriter/{PostTitle}_{PostRandomizer}/{FileName}. At least now we have a distinct subfolder per article again. Anyway, still no fancy auto numbering of the images, therefore the problem with multiple pasted images won’t be solved with this registry entry.

Because I don’t have any desire to lose uploaded files I chose for a more conventional solution: I modified the blog software to never overwrite uploaded files. If a file name collision is encountered the file is moved into a subfolder named after some GUID.

It has the drawback that changing an image from within WLW will always cause a new file to be added to the server (instead of replacing the old one). Anyway, I prefer a few more files on the server over overridden files.

Nevertheless I find it a bit weird that I haven’t read much about this issue yet. Maybe it really is only me using some wrong settings?

Posted in: Meta

Tags: ,

Comments (5) -

Hi, Andre.

Thanks for using Windows Live Writer.  Sorry to hear that it's giving you grief.  I'm a dev on the team.  I'll look into this and let you know what I find.

I have to admit that I'm amazed to get a response from the dev team that quick. It'd be awesome if you could look into this, thanks a lot.
BTW: while it might not be apparent from this post, WLW in general gives me (way) more joy than grief Smile Keep up your good work.

Actually, we've had the same image uploading logic in general for a while. What changed with WLW 2009 is that we have more explicit support for BlogEngine.NET--when a blog platform gets large enough on our radar, we try to find the best settings for it and bake that knowledge into the program.

In this case, we were attempting to fix a different problem with image uploading to BlogEngine.NET--looks like it was related to uploading images with non-ASCII characters, looks like BlogEngine.NET doesn't like that. In the process of fixing that problem we changed fileUploadNameFormat but didn't include the randomizer token.

Thanks for the feedback, we'll look into getting this fixed.

Looking forward to it Smile

Interesting article. I am battling a different problem - in my case, the platform is WordPress. I am trying to figure out a way to choose what name to give to screenshots that I paste into the post that I am creating.

As you rightly said, they get named image.png, and so on....