Hi all:
I have a web application that plugs into to allow users to read local files
and then upload those files to Sharepoint, but for some reason when I try to
run the code from a client machine (it works fine on the server) I get the
following exception:
System.IO.IOException: The device is not ready.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess
access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize,
FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean
bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess
access)
at WebService1.WebForm1.uploadDocToSts() in
c:\Inetpub\Development\stsupload\upload.aspx.cs:li ne 141
Here is the code:
try
{
// Grab the local file and read it into the buffer
FileStream fStream = new FileStream(sFileName, FileMode.Open,
FileAccess.Read);
byte[] byteBuffer = new byte[fStream.Length];
fStream.Read(byteBuffer, 0, Convert.ToInt32(fStream.Length));
fStream.Close();
}
catch (Exception F)
{
txtDebug.Text += "File Error " + F.ToString();
}
Can anyone make a suggestion?
John. 2 2861
What do you mean "on the client". What you posted is server code. sFileName
better be a file on the server
"John" <js********@hotmail.comwrote in message
news:03**********************************@microsof t.com...
Hi all:
I have a web application that plugs into to allow users to read local
files and then upload those files to Sharepoint, but for some reason when
I try to run the code from a client machine (it works fine on the server)
I get the following exception:
System.IO.IOException: The device is not ready.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess
access, Int32 rights, Boolean useRights, FileShare share, Int32
bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String
msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess
access)
at WebService1.WebForm1.uploadDocToSts() in
c:\Inetpub\Development\stsupload\upload.aspx.cs:li ne 141
Here is the code:
try
{
// Grab the local file and read it into the buffer
FileStream fStream = new FileStream(sFileName, FileMode.Open,
FileAccess.Read);
byte[] byteBuffer = new byte[fStream.Length];
fStream.Read(byteBuffer, 0, Convert.ToInt32(fStream.Length));
fStream.Close();
}
catch (Exception F)
{
txtDebug.Text += "File Error " + F.ToString();
}
Can anyone make a suggestion?
John.
"John" <js********@hotmail.comwrote in message
news:03**********************************@microsof t.com...
Hi all:
I have a web application that plugs into to allow users to read local
files and then upload those files to Sharepoint, but for some reason when
I try to run the code from a client machine (it works fine on the server)
I get the following exception:
System.IO.IOException: The device is not ready.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess
access, Int32 rights, Boolean useRights, FileShare share, Int32
bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String
msgPath, Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess
access)
at WebService1.WebForm1.uploadDocToSts() in
c:\Inetpub\Development\stsupload\upload.aspx.cs:li ne 141
Here's how to fix this. Assume that your computer isn't lying.
If that's true, then there's a real device that's really not ready.
Which device could it be?
try
{
FileStream s = new FileStream(sFileName, ...);
}
catch (Exception ex)
{
throw new Exception(string.Format("Can't deal with file {0}",
sFileName), ex);
}
John This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Hans-Joachim Widmaier |
last post by:
Hi all.
Handling files is an extremely frequent task in programming, so most
programming languages have an abstraction of the basic files offered by
the underlying operating system. This is...
|
by: jase_dukerider |
last post by:
Hi I have an assignment to hand in shortly for which I am after some
guidance. The task is to read a WAV file, request a fade in /out time
for the track from the user and the do the fade by...
|
by: Mark |
last post by:
Hello,
I have researched and tried every thing I have found on the web, in groups
and MS KB articles. Here is what I have.
I have a Windows 2000 Domain Controller all service packs and...
|
by: Sky Sigal |
last post by:
I have created an IHttpHandler that waits for uploads as attachments for a
webmail interface, and saves it to a directory that is defined in
config.xml.
My question is the following:
assuming...
|
by: tshad |
last post by:
I have an upload file input as:
<input id="MyFile" style="width:300px" type="File" runat="Server">
This works fine, but I find that if my page doesn't pass validation during
postback, the page...
|
by: Dan |
last post by:
Hi,
I know this code is not entirely javascript, but bare with me. Can you
please tell me why this does not work:
page: filemanager.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0...
|
by: pank7 |
last post by:
hi everyone,
I have a program here to test the file IO(actually output) with buffer
turned on and off. What I want to see is that there will be obvious
differece in time. Here I have an input...
|
by: Martin Joergensen |
last post by:
Hi,
I have some files which has the following content:
0 0 0 0 0 0
0 1 1 1 1 0
0 1 1 1 1 0
0 1 1 1 1 0
0 1 1 1 1 0
0 0 0 0 0 0
|
by: laredotornado |
last post by:
Hi,
I'm using PHP 4.4.4 on Apache 2 on Fedora Core 5. PHP was installed
using Apache's apxs and the php library was installed to
/usr/local/php. However, when I set my "error_reporting"...
|
by: KevinADC |
last post by:
Note: You may skip to the end of the article if all you want is the perl code.
Introduction
Many websites have a form or a link you can use to download a file. You click a form button or click...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |