Click here to Skip to main content
15,888,733 members
Home / Discussions / C#
   

C#

 
AnswerRe: Improve Project Pin
PIEBALDconsult6-Sep-12 6:56
mvePIEBALDconsult6-Sep-12 6:56 
GeneralRe: Improve Project Pin
WebMaster6-Sep-12 7:06
WebMaster6-Sep-12 7:06 
GeneralRe: Improve Project Pin
PIEBALDconsult6-Sep-12 7:17
mvePIEBALDconsult6-Sep-12 7:17 
GeneralRe: Improve Project Pin
WebMaster6-Sep-12 7:27
WebMaster6-Sep-12 7:27 
AnswerRe: Improve Project Pin
PIEBALDconsult6-Sep-12 7:23
mvePIEBALDconsult6-Sep-12 7:23 
GeneralRe: Improve Project Pin
WebMaster6-Sep-12 7:29
WebMaster6-Sep-12 7:29 
AnswerRe: Improve Project Pin
Eddy Vluggen6-Sep-12 7:49
professionalEddy Vluggen6-Sep-12 7:49 
AnswerRe: Improve Project Pin
Gerry Schmitz6-Sep-12 9:08
mveGerry Schmitz6-Sep-12 9:08 
GeneralRe: Improve Project Pin
WebMaster6-Sep-12 9:11
WebMaster6-Sep-12 9:11 
AnswerRe: Improve Project Pin
RobCroll6-Sep-12 15:36
RobCroll6-Sep-12 15:36 
Questionprecision of digits durring conversion Pin
Fred 346-Sep-12 5:01
Fred 346-Sep-12 5:01 
AnswerRe: precision of digits durring conversion Pin
Pete O'Hanlon6-Sep-12 5:09
mvePete O'Hanlon6-Sep-12 5:09 
AnswerRe: precision of digits durring conversion Pin
Dave Kreskowiak6-Sep-12 5:34
mveDave Kreskowiak6-Sep-12 5:34 
AnswerRe: precision of digits durring conversion Pin
PIEBALDconsult6-Sep-12 5:39
mvePIEBALDconsult6-Sep-12 5:39 
QuestionC# visual studio 2010 Pin
Member 94105226-Sep-12 3:57
Member 94105226-Sep-12 3:57 
AnswerRe: C# visual studio 2010 Pin
Pete O'Hanlon6-Sep-12 4:01
mvePete O'Hanlon6-Sep-12 4:01 
AnswerRe: C# visual studio 2010 Pin
Member 94105226-Sep-12 4:17
Member 94105226-Sep-12 4:17 
GeneralRe: C# visual studio 2010 Pin
Pete O'Hanlon6-Sep-12 4:48
mvePete O'Hanlon6-Sep-12 4:48 
QuestionC# using linq Pin
classy_dog6-Sep-12 3:45
classy_dog6-Sep-12 3:45 
AnswerRe: C# using linq Pin
Pete O'Hanlon6-Sep-12 4:02
mvePete O'Hanlon6-Sep-12 4:02 
AnswerRe: C# using linq Pin
Clifford Nelson6-Sep-12 13:48
Clifford Nelson6-Sep-12 13:48 
Questionsize of fileupload Pin
ptvce5-Sep-12 21:13
ptvce5-Sep-12 21:13 
AnswerRe: size of fileupload Pin
Shameel5-Sep-12 22:56
professionalShameel5-Sep-12 22:56 
AnswerRe: size of fileupload Pin
Pete O'Hanlon5-Sep-12 23:37
mvePete O'Hanlon5-Sep-12 23:37 
That code doesn't work because ASP.NET is a server side technology. In other words, you have to transfer the posted file to the server before it can work out how big it is. There are things that you can do, but they generally involve compromises - one trick is to use a flash uploader control which can get access to the users hard disk to retrieve this information. Alternatively, if you know that your clients aren't going to be using Internet Explorer, you can use this function:
JavaScript
<script type='text/javascript'> 
function showFileSize() {     
  var input, file;      
  if (typeof window.FileReader !== 'function') { 
    alert('The file API isn't supported by your browser'); 

    return;     
  }      
  input = document.getElementById('fileinput'); // Or whatever name your input control is...
  if (!input) {
    alert('You don't seem to have a file input control');
    return;
  }
  if (!input.files) {  
    alert('This browser doesn't seem to support files.'); 
    return;
  }
  if (!input.files[0]) { 
    alert('You havent picked a file');  
    return;
  }     

  file = input.files[0];
  alert("The file is " + file.size + " bytes");
</script>
If your clients have IE, you may have to use an ActiveX control.

A final note - you really should have posted this in the ASP.NET forum.

*pre-emptive celebratory nipple tassle jiggle* - Sean Ewington

"Mind bleach! Send me mind bleach!" - Nagy Vilmos


CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier

QuestionC# WinService starts in win7 but not in win2088 Pin
Daniel Jansson5-Sep-12 20:56
Daniel Jansson5-Sep-12 20:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.