Problem with file path

G

Guest

I'm getting the file path via webservice using following code:-
FileInfo fInfo = new FileInfo(filename);
return fInfo.FullName;

the return file backed as C:\test\images\1.jpg

in application side .aspx.cs file i stored the returned path in public
variable to read it from javascript function , when read the filename in js
function as follows

<%= sFileName %> the path trim and be c:test
why? and what can I do to solve this problem?
 
S

Saber

I'm not sure,
But perhaps you should convert C:\test\images\1.jpg
to C:\\test\\images\\1.jpg before passing to java script.
 
G

Guest

are there other solutions? because i will have to get into each file and
place \\\
after each \ in file path
 
S

Saber

Try it:

FileInfo fInfo = new FileInfo(filename);
string fn = fInfo.FullName;
fn.Replace("\","\\"); // or fn.Replace("\","\\\") I don't know!
return fn;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,990
Messages
2,570,211
Members
46,796
Latest member
SteveBreed

Latest Threads

Top