Author | Message |
---|---|
kknaur
Posts: 540
|
Posted 19:25 Oct 13, 2010 |
I just tried to upload a blank .txt file to test and the upload servlet would not perform the upload. However it works fine for any other files that have something to write in them. Is this ok for this assigment, or should we be able to upload blank files as well?
edited: Have another question now. Using Dr. Sun's example for uploading, how do you check if the text field is blank. In the example, and also in my code if the user does not pick a file to upload and just hits the OK button then i get a file not found exception. Is there a way to check for a blank upload input? Last edited by kknaur at
20:10 Oct 13, 2010.
|
Phobe
Posts: 40
|
Posted 19:28 Oct 13, 2010 |
Blank files appear to work with mine. |
kknaur
Posts: 540
|
Posted 19:42 Oct 13, 2010 |
hmmm i'll have to fix my code then
edited: well i tried to upload a blank file in the example that Dr. Sun showed us in class and i can't seem to upload blank files using it, and i basically reused that code in my own project to handle file uploads. Last edited by kknaur at
20:06 Oct 13, 2010.
|
cysun
Posts: 2935
|
Posted 22:06 Oct 13, 2010 |
I tried uploading two blank files (i.e. files with 0 byte) using my fileupload sample code and it seems to be working fine. I tested it with both Firefox and Eclipse's embedded browser (IE). You can use item.getName() to check for blank file input field. |
kknaur
Posts: 540
|
Posted 10:03 Oct 14, 2010 |
Must be a browser specific thing. I tested it in IE, the internal browser and firefox and with IE and the internal browser it will upload the blank file, but with Firefox it will not. |