[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

file uploader problem in asp.net

Posted on 2011-09-12
3
Medium Priority
?
255 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 2000 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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

650 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