SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Evangelist priti's Avatar
    Join Date
    Aug 2006
    Location
    India
    Posts
    488
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    how to find filesize

    Hello,

    Can someone help to find the filesize ??
    i have got the path of the file c:\priti\me.jpg and now i want to get teh filesize of this can someone tell me how can i do this???

    regards

  2. #2
    SitePoint Evangelist borna's Avatar
    Join Date
    Jun 2006
    Location
    Iran, Tehran
    Posts
    475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Why do you think it could be done via javascript. I have seen (and done) such issues by something like this Java code:
    Code:
    File f=new File(path_name);
    f.length();
    -1/2=999?

  3. #3
    SitePoint Evangelist borna's Avatar
    Join Date
    Jun 2006
    Location
    Iran, Tehran
    Posts
    475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    A simpe complete code looks like this:
    Code:
    import java.io.File;
    public class file {
        
            public static void main(String args[]){
            String name="JavaScript.doc";
            String path="C:\\Documents and Settings\\JavaScript\\Events\\";
            System.out.println(path+name);
            
            File f =new File(path+name);
            long a=f.length();
            System.out.print(a);
        }
        
    }
    -1/2=999?

  4. #4
    SitePoint Evangelist priti's Avatar
    Join Date
    Aug 2006
    Location
    India
    Posts
    488
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by borna View Post
    A simpe complete code looks like this:
    Code:
    import java.io.File;
    public class file {
        
            public static void main(String args[]){
            String name="JavaScript.doc";
            String path="C:\\Documents and Settings\\JavaScript\\Events\\";
            System.out.println(path+name);
            
            File f =new File(path+name);
            long a=f.length();
            System.out.print(a);
        }
        
    }
    Well i got stuckup thats why :-)
    i am making an ajax request for uploading the files to server but while i am making a header for post request my file gets upload but nor wth correct content and size.so thats why i searched how to read the file content and know the filesize in javascript.

    but thanks for the reply
    thanks & regards
    Priti


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •