?
Solved

file uploader problem in asp.net

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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses
Course of the Month16 days, 9 hours left to enroll

864 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