1

I'm using C# and I'm trying to download a file and save it to the disk. Everything works with not too long URIs, but when I have very long one (around 300 characters), the file gets downloaded to the disk and save, but when I try to open it says it can't be opened, not a valid bitmap file or format is not supported (it's a jpg file)

The filename I'm using is short, and I see the file in the disk with a size of 88KB, so seems it has something but doesn't work.

I'm using Windows Server 2012.

Any idea how to solve this?

UPDATE

If I open the image (in Amazon S3) from the browser I can see the image file, if I save the file to disk (using right click on the image), then the image get saved corrupted (I can't open it).

Any idea why?

Thanks in advance. Guillermo.

polonskyg
  • 4,269
  • 9
  • 41
  • 93

1 Answers1

0

If I understand well, you are writing a C# code which tries to Download a file from a URL. When this file is reprensented by a long URI, you download something but it seems correputed. Am I correct ? If yes, I would have a look into this article I found

https://serverfault.com/questions/232986/overcoming-maximum-file-path-length-restrictions-in-windows

It seems there are some issues with deep path. Any chance you can manage some aliases on the Server side ?

  • Hi, thx for replying. I can't change the name on the server and you're correct, the file gets downloaded but seems corrupted. I'll take a look at the link. thx. – polonskyg Nov 17 '17 at 14:12