Results 1 to 4 of 4

Thread: Pleaes convert this code form php to ASP.net

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2009
    Posts
    340

    Question Pleaes convert this code form php to ASP.net

    Greetings...
    i am a php coder but don't know asp/asp.net. I have a very simple php code. but it as a limitation as my php server is 32bit it don't shows file size larger than 2gb. So, i need to convert below code to asp.net

    so, if anyone can help me to convert this code then it would be great

    here is the code:
    Code:
    <?php
    
    	$strFilesArray = glob('../*');
    	$strData ='';
    	foreach($strFilesArray as $strFile)
    	{
    		if(is_file($strFile))
    		{
    			$strData = $strData . basename($strFile) . '//' . rawurlencode(basename($strFile)) . '//' . filesize($strFile) . "\r\n";
    		}
    	}
    	if($strData == '')
    	{
    		$strData = 'No Files Found!';
    	}
    	
    	echo $strData;
    
    ?>
    thanks in advance
    best regards

  2. #2
    Frenzied Member KGComputers's Avatar
    Join Date
    Dec 2005
    Location
    Cebu, PH
    Posts
    2,020

    Re: Pleaes convert this code form php to ASP.net

    I dont know PHP. So, what's the functionality or purpose of that code?

    KGC
    CodeBank: VB.NET & C#.NET | ASP.NET
    Programming: C# | VB.NET
    Blogs: Personal | Programming
    Projects: GitHub | jsFiddle
    ___________________________________________________________________________________

    Rating someone's post is a way of saying Thanks...

  3. #3
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: Pleaes convert this code form php to ASP.net

    @Shohas_ifas,

    If you want someone to convert the code for you, you need to first explain to us what the function and purpose of the original code is such as KGComputers asked. There may even be ASP.NET code that have already been written to do what you require so if you post the function and purpose of the code in post #1 we could find the asp.net equivalent for you.
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Dec 2009
    Posts
    340

    Re: Pleaes convert this code form php to ASP.net

    Quote Originally Posted by Nightwalker83 View Post
    @Shohas_ifas,

    If you want someone to convert the code for you, you need to first explain to us what the function and purpose of the original code is such as KGComputers asked. There may even be ASP.NET code that have already been written to do what you require so if you post the function and purpose of the code in post #1 we could find the asp.net equivalent for you.
    thanks a lot for your reply sir..

    Please see below code instead, i have commented it, hope this will help you to understand the code purpose

    PHP Code:
    <?php

        
        $strFilesArray 
    glob('../*'); // get all files list into array of parent folder. example if script file is in "sample\test\test.php" it will get all files form the sample folder.
        
    $strData =''//variable to store results
        
    foreach($strFilesArray as $strFile//loop through all items in the array 
        
    {
            if(
    is_file($strFile)) // check if current item in the loop is file or folder. If file proceed
            
    {
                
    $strData $strData basename($strFile) . '//' rawurlencode(basename($strFile)) . '//' filesize($strFile) . "\r\n"
                
    /*
                store the result in the variable 
                in php . means & (Concatenate/join)
                basename($srfile) = it returns only the file name with extension ; resource = http://php.net/manual/en/function.basename.php
                rawurlencode($strfile) = it convert the plain text to urlencdoed text; resource = http://php.net/manual/en/function.rawurlencode.php
                filesize($strFile) = get the file size in bytes; resource = http://php.net/manual/en/function.filesize.php
                "\r\n" = new line (cr and lf) in vb.net it is environment.newline
                */
                
            
    }
        }
        if(
    $strData == '')
        {
            
    $strData 'No Files Found!'// if not files found then this statements carried out
        
    }
        
        echo 
    $strData//export/render the data to user/browser

    ?>
    thanks in advance

    best regards

Tags for this Thread

Posting Permissions

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



Click Here to Expand Forum to Full Width