Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Sep 11, 2011 08:07 AM by shabirhakim1
Member
69 Points
42 Posts
Sep 10, 2011 10:15 PM|LINK
Hi, I have been using the following PHP script on a site development but am wanting to recreate the function in an application I am building in ASP.NET.
Any guidance you can give would be appreciated. :-)
<?php $location = 'albums'; $album_name = $_GET['album_name']; $files = glob($location . '/' . $album_name . '/*.{jpg,gif,png}', GLOB_BRACE); $encoded = json_encode($files); echo $encoded; unset($encoded);
Thanks,
PJ
Star
13496 Points
2145 Posts
Sep 11, 2011 08:07 AM|LINK
I don't know which language you are use so I will make you explain in simple english then you can write code using your favourite language
1)<?php : is begin of the script which can be replaced with
<script runat="server"> protected void Page_Load(object sender, EventArgs e) { } </script>2) $location = 'albums'; can be replaced with
string location="albums";
3)$album_name = $_GET['album_name']; can be replaced withstring album_name = Request.QueryString["album_name"];4)$files = glob($location . '/' . $album_name . '/*.{jpg,gif,png}', GLOB_BRACE); can be replaced with
string[] files = new string[]files=Directory.GetFiles(location );5) Use for loop to iterate through array list which contains files/images and display .Regards
PJLaurenson
Member
69 Points
42 Posts
PHP to ASP.NET Conversion Help
Sep 10, 2011 10:15 PM|LINK
Hi, I have been using the following PHP script on a site development but am wanting to recreate the function in an application I am building in ASP.NET.
Any guidance you can give would be appreciated. :-)
<?php
$location = 'albums';
$album_name = $_GET['album_name'];
$files = glob($location . '/' . $album_name . '/*.{jpg,gif,png}', GLOB_BRACE);
$encoded = json_encode($files);
echo $encoded;
unset($encoded);
Thanks,
PJ
shabirhakim1
Star
13496 Points
2145 Posts
Re: PHP to ASP.NET Conversion Help
Sep 11, 2011 08:07 AM|LINK
I don't know which language you are use so I will make you explain in simple english then you can write code using your favourite language
1)<?php : is begin of the script which can be replaced with
3)$album_name = $_GET['album_name']; can be replaced with
string album_name = Request.QueryString["album_name"];
4)$files = glob($location . '/' . $album_name . '/*.{jpg,gif,png}', GLOB_BRACE); can be replaced with