Get File Size from Server directory after upload.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
thenndral
Forum Newbie
Posts: 20
Joined: Wed Sep 29, 2010 8:36 pm

Get File Size from Server directory after upload.

Post by thenndral »

Hello,

I upload a movie file to server[Linux server].

After upload I would like to check, the upload file is properly uploaded or not. How to check it?
I need code for upload error handling and file size of my uploaded file from the server.
I need code help.Thanks so much.

Thanks in advance,
Thendral
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Get File Size from Server directory after upload.

Post by requinix »

In the $_FILES array is the size of the uploaded file. If you don't believe HTTP and PHP are doing their job, print that number out and compare it with your local file's size.
thenndral
Forum Newbie
Posts: 20
Joined: Wed Sep 29, 2010 8:36 pm

Re: Get File Size from Server directory after upload.

Post by thenndral »

Hi tasairis,

Sorry I can't able to understand.
I found some code,
I'm using move_uploaded_file for move file, so using conditional statement am checking. If it returns false, show message "Upload fails". See the code below,

if(move_uploaded_file($_FILES['adFile']['tmp_name'],"upload/" .
$_FILES["adFile"]["name"]))
{
echo "Stored in: " . "upload/" . $_FILES["adFile"]["name"];
} else {
echo "Error, couldn't save uploaded file.";
}
Can I use this way or could you give me some code sample.

Thanks,
Thendral
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Get File Size from Server directory after upload.

Post by requinix »

tasairis wrote:In the $_FILES array is the size of the uploaded file.
Your first step is to find that number.
Your second step is to do whatever you want with that number.
thenndral
Forum Newbie
Posts: 20
Joined: Wed Sep 29, 2010 8:36 pm

Re: Get File Size from Server directory after upload.

Post by thenndral »

hi tasairis ,

Thank you, I fix it.

Thanks Again,
Thendral
Post Reply