Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 199
  • Last Modified:

Posting a file and evaluating its extension

I have a asp.net page that calls this code.  If I post a file from the machine running IIS, this code works fine.  If my posted file is from a network server, the code returns the null.  See below

public DataSet GetOrderInfo(string logFileName)  //bring the datafile into a dataset.
        {            
            if (File.Exists(logFileName))  // if the file exists, create the dataset
            {
              if (logFileName.EndsWith("est"))
                {
                    DataSet ds = CreateDEBOM(logFileName);
                    return ds;
                }
                else if (logFileName.Contains("xls"))
                {
                        DataSet ds = CreateXLSBOM(logFileName);
                        return ds;
                }
                else
                {
                    DataSet ds = CreateXLSBOM(logFileName);
                    return ds;
                }
            }
             else
                {
                    return null;
                }
           
        }

Please help me with this will ya?
0
BoggyBayouBoy
Asked:
BoggyBayouBoy
  • 2
  • 2
1 Solution
 
jimstarCommented:
What is the full logFileName that you are passing in each case?
0
 
Fernando SotoCommented:
By the looks of the code the reason why it would return a null is that the file does not exist on the server?

What is the value of logFileName when entering the procedure?
0
 
BoggyBayouBoyAuthor Commented:
here's the value of the filename string.  under the first scenario, it was uploaded from the local machine.

in the second, it was uploaded from a server.

FileUpload1.PostedFile.FileName       (local machine)

"C:\\Documents and Settings\\Administrator\\Desktop\\small1.est"      

FileUpload1.PostedFile.FileName      (server)

"\\\\engineering\\DETruss\\CRESTVIEW ELEMENTARY\\small1.est"      
0
 
BoggyBayouBoyAuthor Commented:
The file did not exist on the IIS server... that was the issue.  Thanks!
0
 
Fernando SotoCommented:
Not a problem, glad I was able to help. ;=)
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now