Solved

file uploader problem in asp.net

Posted on 2011-09-12
3
245 Views
Last Modified: 2012-05-12
I have two users on our local network.  I'm trying to do the following:
System.IO.Path.GetDirectoryName(fuFileName.PostedFile.FileName).ToLower

On one machine I am getting the directory name.  On the other I am getting nothing.  I tried just printing out fuFileName.PostedFile.FileName.ToLower on the machine I can use the above statement on I'm getting the full path and file name.  On the other I'm getting only the filename.

The code is successful on several computers running ie7 and ie8 but this particular one (running ie 8) will not work.  I have read that secruity reasons will prevent the client path to be returned but then i also read it will work on the local network.  the reason I want it is because the file needs to come from one central location on the server.  I'm using the fileuploader control not really as a file uploader but as a file picker.

Hope this makes sense.  I'm thinking there is some security setting in ie 8 preventing this from working.
0
Comment
Question by:Fraser_Admin
[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 Comments
 

Author Comment

by:Fraser_Admin
ID: 36524211
one other thing...this computer does not have any internet access.  the other computer that it works on do have internet access.  not sure if that is what could be causing the problem or not.  but it is the only thing other than the versions I have found that are different.
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 36526211
What is the current security zone selected on IE8 on that computer? Is it same as other computers?
0
 
LVL 35

Accepted Solution

by:
Robert Schutt earned 500 total points
ID: 36526340
If you don't really want to upload the file you may want to use client-side javascript to stop the file from being sent to the server. Also you can copy the file name to a hidden field so that your problem might be solved.

<html>
 <head>
  <script type="text/javascript">
   var savObject = null;
   function copyValue(oFile) {
    savObject = oFile;
    if (oFile.value != '') {
     oFile.form.elements['copiedFile'].value = oFile.value; // save full path to file in hidden form element
    }
   }
  function checkSubmit(oForm) {
   if (savObject != null) {
     savObject.disabled = true; // don't send file
     oForm.elements['sbm'].disabled = true; // prevent double click and also don't send value of button...
     return true;
    } else {
     return false;
    }
   }
  </script>
 </head>
 <body>
  <form name="fileUpload" method="post" action="save.php" onsubmit="return checkSubmit(this)">
   <input type="hidden" name="copiedFile">
   <input type="file" name="origfile" onblur="copyValue(this)">
   <br><br>
   <input type="submit" name="sbm" value="Save">
  </form>
 </body>
</html>

Open in new window

0

Featured Post

Containers & Docker to Create a Powerful Team

Containers are an incredibly powerful technology that can provide you and/or your engineering team with huge productivity gains. Using containers, you can deploy, back up, replicate, and move apps and their dependencies quickly and easily.

Question has a verified solution.

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

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …

696 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