/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] Code to get filesize

Hi experts,

I wrote this code to get file names and their sizes but the its not working, whats the error, please help.

[CODE]
<script language=”javascript”>
myfiles = new Array();
myfilesize=new Array();
<?PHP
$files = GLOB(‘*.*[3]’);
foreach ($files as $value)
{
print “myfiles.push(“$value”);”;
print “myfilesize.push(filesize($value));”;
}
?>
</script>

[/CODE]

to post a comment
PHP

4 Comments(s)

Copy linkTweet thisAlerts:
@MindzaiJul 08.2009 — "it isn't working" isn't very helpful for people trying to debug your code, however glob should be in lower case. If this isn't the problem you will need to post exactly what is not working, the result you expect to get, and the result you actually get.
Copy linkTweet thisAlerts:
@NogDogJul 08.2009 — I suspect the problem is that you are not really calling the filesize() function, since you have the call within a string literal.
[code=php]
print "myfilesize.push(" . filesize($value) . ");";
[/code]
Copy linkTweet thisAlerts:
@MindzaiJul 08.2009 — Well spotted ?
Copy linkTweet thisAlerts:
@nyt1972authorJul 09.2009 — Thanks NogDog, it worked.

And Mindzai you r right, this isn't, isn't helpful. Thanks for the response.

Regards.
×

Success!

Help @nyt1972 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.25,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...