Solved

FileUpload full path in firefox 3

Posted on 2008-10-06
8
5,806 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
Comment Utility
0
 
LVL 54

Assisted Solution

by:b0lsc0tt
b0lsc0tt earned 35 total points
Comment Utility
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
Comment Utility
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
 
LVL 54

Expert Comment

by:b0lsc0tt
Comment Utility
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
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
LVL 28

Expert Comment

by:Pravin Asar
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
will flash pass the file name?
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

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…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
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…

763 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now