Solved

FileUpload full path in firefox 3

Posted on 2008-10-06
8
5,832 Views
Last Modified: 2012-05-05
I am trying to develop a newsletter system in C# and because of some specific issues I need the full path of the .html file I am sending as a newsletter inline message body.

When I am using FileUploadCntrl.PostedFile.FileName or  FileUploadCntrl.FileName it only gives me the filename without the full path in Firefox, while it works just fine in IE.

I tried a javascript solution (which uses a hidden textbox.text to save the file path and then retrieve it from textbox when I need to use it) I saw somewhere and I have the same results. Javascript I am using like this:

ID="SendBtn" onClientClick="document.getElementById('HiddenTextBox').value = document.getElementById('AttachFileUpload').value" runat="server"...

Still the same result in Firefox.

Anyone ran into this? Anyone has a solution which would work across different browsers?

Thanks in advance!
0
Comment
Question by:sabritahiri
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 28

Accepted Solution

by:
Pravin Asar earned 90 total points
ID: 22660443
0
 
LVL 54

Assisted Solution

by:b0lsc0tt
b0lsc0tt earned 35 total points
ID: 22661574
If you need to get this you will have to look at developing something like a Java applet.  They can work in the browser and will have the security access to get that info.  Of course this involves a download (usually really small and easy) by the user and they can disable or refuse the applet but it is a method that would work.  Javascript won't be able to because of browser security, as pointed out by pravinasar above.  If you are stuck with Javascript only (or clientside script) then all credit to him for the answer.
If you have a question about what I have said then let me know.
bol
0
 

Author Comment

by:sabritahiri
ID: 22662234
There is some kind of solution using javascripting here: http://forums.asp.net/t/1072949.aspx, however none of this worked for me. I am not sure whether I did it right way, but it seems like people in that forum claim that they have a solution using javascript.
0
MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

 
LVL 54

Expert Comment

by:b0lsc0tt
ID: 22662409
I may have missed it but that forum seems to say the path was still missing when Firefox 3 was used.  That should be caused by the change (security fix) mentioned in pravinasar's link.  Did you notice the part at the end of the page that was about "File Upload Fields"?  That should be the cause of this and won't be something Javascript can workaround.  If it works in IE now I would not be suprised if it also changes since most would consider that a security hole.
Let me know how this helps or if I missed a specific comment in that other forum you linked to which seemed to provide that info even for FF3.
bol
0
 
LVL 28

Expert Comment

by:Pravin Asar
ID: 22662444
Look at the post at the 08-26-2008, 4:56 AM


http://forums.asp.net/t/1072949.aspx

It does not work.

Earlier , I had tried similar approach (using hidden field),

For testing purpose, try the following code in IE and FF




<html>
<HEAD>
<head>
<script type="text/javascript" language="JavaScript">
</script>
</head>
<body>
<form method="post" name="f" enctype="multipart/form-data" onsubmit="return check();">
<p>
<br>
<input type="file" name="pic" size="40" onchange="alert (this.value);">
<p>
Please include a short explanation:<br>
<p>
<input type="submit" value="Send">
</form>
</body>
</html>

Open in new window

0
 

Author Closing Comment

by:sabritahiri
ID: 31503631
It's my first time posting a question and solution but I feel that this is a fair spread of points (I am not sure how important are the points either).
Nevertheless, thanks a bunch to both of you!
0
 
LVL 54

Expert Comment

by:b0lsc0tt
ID: 22663326
I'm glad I could help a bit.  The split seems fine to me.  The other expert provided the main answer.  Thanks for the grade, the points and the fun question.
bol
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 22666584
will flash pass the file name?
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question