473,405 Members | 2,210 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

getting information about the file

Hi

I have to figure about some information of a file that a user is uploading.
Is there a library or a package that i can use to get some kind of information about the file. I have other options to parse the name of the file and see what type of file it is like .html , .swf etc but it would be nice if i can get some more, like the file size modified date etc with the php library?

Thanks
varun
Jun 13 '07 #1
6 1366
Purple
404 Expert 256MB
Hi,

If you are trying to process it as the user uploads it;

using filesize() on your file in upload_tmp_dir will get you the file size, filetime() will get you its modified time (I expect this will be the uploaded time and date).

If you want the info before the user does the upload then you are into client side techniques to get that info..

Purple
Jun 13 '07 #2
Thanks purple
That was useful
Jun 13 '07 #3
pbmods
5,821 Expert 4TB
Also, check out your $_FILES array.
Jun 14 '07 #4
Thanks for the info, $_FILES["filename"]["type"] solved the problem
Jun 15 '07 #5
Purple
404 Expert 256MB
Hi varun aggarwal,

a word of caution with $_FILES["filename"]["type"], php.net states:

Expand|Select|Wrap|Line Numbers
  1. $_FILES['userfile']['type']
  2.  
  3. The mime type of the file, if the browser provided this information. An example would be "image/gif". This mime type is however not checked on the PHP side and therefore don't take its value for granted. 
read more here

If you read on you will see there is an opportunity (depending what you are doing) to allow malicious code to be executed on your server..

Take a look and apply as required based on your environment.

Regards Purple
Jun 15 '07 #6
pbmods
5,821 Expert 4TB
If you read on you will see there is an opportunity (depending what you are doing) to allow malicious code to be executed on your server..
Here's the comment that was left on the manual page:
http://uk.php.net/manual/en/features...load.php#53133

Very interesting; I will have to keep this in mind.
Jun 15 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Jim | last post by:
I need some help getting started with a .NET web project for a commercial site. I am new to .NET and my understanding of some (but not all) of its concepts is a little sparse. I apologize for the...
0
by: Jim | last post by:
This si a repost, I apologize but perhaps my original inquiry got buried under all the usenet spam... I need some help getting started with a .NET web project for a commercial site. I am new to...
3
by: Larry Tate | last post by:
I have had a monstrous time getting any good debugging info out of the .net platform. Using ... ..NET Framework 1.1 Windows 2K Server VB.NET <- is this the problem? error handling in the...
2
by: William Gower | last post by:
I am trying to display a page that has a data grid on it. I get this message Description: An error occurred during the processing of a configuration file required to service this request....
1
by: hzgt9b | last post by:
(FYI, using VB .NET 2003) Can someone help me with this... I'm trying to read in an XML file... it appears to work in that the DataSet ReadXML method dose not fail and then I am able to access the...
4
by: Hiten | last post by:
Hi, I am trying to find a way to get and change file summary information. I tried using FileInfo class, but it doesn't give me information such as "Author,Title,Rating" etc. Is there a way to...
6
by: sathyashrayan | last post by:
Dear Group, Please look at the following demo link. http://www.itsravi.com/demo/new_pms/admin/addproject.php
3
by: ArmageddonAsh | last post by:
I'm trying to make an application that will allow the user to enter data into a flexgrid (that's done) and then save the data from that flexgrid into a CSV file but even though the file is made none...
9
by: mekalai82 | last post by:
i have information.php file that file contain following coding <?php echo phpinfo(); ?> while i calling the URL ("http://localhost/information.php"). i am getting the coding <?php echo...
185
by: jacob navia | last post by:
Hi We are rewriting the libc for the 64 bit version of lcc-win and we have added a new field in the FILE structure: char *FileName; fopen() will save the file name and an accessor function will...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.