Solved

FileUpload full path in firefox 3

Posted on 2008-10-06
8
5,866 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 29

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
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

 
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 29

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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
This article discusses how to implement server side field validation and display customized error messages to the client.
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…
Suggested Courses

621 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