Last post Mar 19, 2010 11:20 AM by brad75552
Mar 15, 2010 06:34 PM|brad75552|LINK
I am using aspose.slides to create PPTx's. Some of the process involves loading jpg's from another server and including them in the presentation. This works fine in my development environment. When I upload
the site to its server, the jpg loading fails.
I am trying to access jpg's on the other server by:
oFS = New FileStream(sFile, FileMode.Open, FileAccess.Read)
This causes an access violation error when run from the server.
I also boiled the code down to reading the file directly:
oImg = System.Drawing.Bitmap.FromFile(sFilePath)
This causes a file not found error.
We have narrowed the problem down to the fact that the File Path has a space in it. How does one solve this problem (while still keeping the space, there is a lot of legacy data)? I have tried replacing the space with %20 or
+. I have tried using Server.UrlEncode. The error message always comes back with the encoding in place (like no decoding is happening).
Mar 16, 2010 06:43 AM|bendahmon|LINK
Can you show the path you're using?
What kind of servers are involved?
Mar 16, 2010 07:24 AM|CrossDomain|LINK
I have no problem accessing files with spaces in the name e.g.
Dim test = System.Drawing.Bitmap.FromFile("C:\Downloads\some space in here\test.png")
test.Save(Server.MapPath("./images/") + "testimage.png")
Mar 17, 2010 03:02 PM|brad75552|LINK
A typical path looks like this:
Most of our art is on this server (rtselp-fs01). (Note that this message also chops the path!).
The web site that accesses this art is on another server and my dev environment is on my dev machine. Everything works from my dev machine and from the server except for the calls mentioned in my first post not working from the web server. For example, the
image is displayed in an img element on other pages on the site whether run from the server or my dev environment. The only failure is when using the FromFile or
FileStream calls from the web server; they work from the dev environment.
I haven't found any way to encode the string that will work. I'm beginning to think that it may be a problem with the IIS on the web server but that just might show my overall frustration with the problem.
Mar 19, 2010 11:20 AM|brad75552|LINK
Thanks to all who tried to help.
Turned out this has nothing to do with the space. It is a permissions issue on the jpg server. Our server guy finally opened up access to everyone and the space did not matter; it did return the jpg file.
Why the call would work from the dev env and not the web server is still a mystery. Why the jpg could be displayed but not accessed via the FileStream call is still unknown.