$_FILES['file']['tmp_name'] value 'none' with .flv movies

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

mikebr
Forum Contributor
Posts: 243
Joined: Sat Sep 28, 2002 7:05 am

$_FILES['file']['tmp_name'] value 'none' with .flv movies

Post by mikebr »

Hi,

I have a basic html/php image upload script that I use for uploading images to a web site, works fine while uploading images, I have now altered it slightly to permit uploading movies but if I use it to upload a .flv movie $_FILES['file']['tmp_name'] returns a value of 'none', this of course presents a problem when I get to:

Code: Select all

if (copy($_FILES['file']['tmp_name'] ,$file_path.$new_file_name))
The $_FILES values returned are as follows...

Code: Select all

$_FILES['file']['name'] //returns 'theMovieName.flv'
$_FILES['file']['tmp_name'] //returns 'none'
$_FILES['file']['type'] //returns 'application/octet-stream'
$_FILES['file']['size'] //returns '0'
Has anyone any experiance uploading .flv movies who might be able to enlighten me as to what the problem might be here?

Thanks
Syranide
Forum Contributor
Posts: 281
Joined: Fri May 20, 2005 3:16 pm
Location: Sweden

Post by Syranide »

same as in another post, MAX_POST_SIZE (or something like that)
all above (default) 4M are discarded.
User avatar
ol4pr0
Forum Regular
Posts: 926
Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador

Post by ol4pr0 »

Besides that i believe you want to move it.

Code: Select all

move_uploaded_file();
Move Uploaded File
mikebr
Forum Contributor
Posts: 243
Joined: Sat Sep 28, 2002 7:05 am

Post by mikebr »

All the .flv movies are under 2MB, the one I am trying to get this to work with is .475

BTW How do I tell if the movie size if $_FILES['file']['size']returns '0'?


Thanks
Syranide
Forum Contributor
Posts: 281
Joined: Fri May 20, 2005 3:16 pm
Location: Sweden

Post by Syranide »

then something is wrong, the size should be there.
EDIT: do a print_r and see what's available.
mikebr
Forum Contributor
Posts: 243
Joined: Sat Sep 28, 2002 7:05 am

Post by mikebr »

print_r($_FILES('file'));

returns sweet nothing but....

Code: Select all

$file_name = $_FILES['file']['name'];
$file_temp_name = $_FILES['file']['tmp_name'];
$file_size = $_FILES['file']['size'];
$file_type = $_FILES['file']['type'];
	
echo "file_name = $file_name<br />file_temp_name = $file_temp_name<br />file_type = $file_type<br />file size: = $file_size";
retuns....

file_name = Pampers.flv
file_temp_name = none
file_type = application/octet-stream
file size: = 0

Strange but there is absolutly nothing on the internet about this issue if it is one, or uploading movies.

PHP Version 4.1.2
Syranide
Forum Contributor
Posts: 281
Joined: Fri May 20, 2005 3:16 pm
Location: Sweden

Post by Syranide »

print_r($_FILES('file')); <-- should be print_r($_FILES['file']);
keep your brackets straight and your parenthesis bent ;)
mikebr
Forum Contributor
Posts: 243
Joined: Sat Sep 28, 2002 7:05 am

Post by mikebr »

...Thanks.

The output is:

Array ( [name] => Pampers.flv [type] => application/octet-stream [tmp_name] => none [size] => 0 )

BTW, I have checked with other .flv movies and the result is the same, these movies do play fine if I upload then using an ftp client.

Thanks
Syranide
Forum Contributor
Posts: 281
Joined: Fri May 20, 2005 3:16 pm
Location: Sweden

Post by Syranide »

well does the uploaded file contain anything, size 0 should imply that it really is zero...

uhm, wait a minute, something is missing, there should be a tmpname and such... are you sure the file isn't zero size or so, coz if I'm not all gone what you printed is not enough... there should be more... such as where the file is...
mikebr
Forum Contributor
Posts: 243
Joined: Sat Sep 28, 2002 7:05 am

Post by mikebr »

I have just tried it with an Mp4 movie, the result...

Array ( [name] => sk_contraction.mp4 [type] => video/mp4 [tmp_name] => none [size] => 0 )
mikebr
Forum Contributor
Posts: 243
Joined: Sat Sep 28, 2002 7:05 am

Post by mikebr »

What I am posting is exactly what is returned by print_r, all the movies I am uploading actually work and range in size from 2.5Mb down to .475Mb. If I upload them manually (ftp client) then they all work as expected.

Thanks
Syranide
Forum Contributor
Posts: 281
Joined: Fri May 20, 2005 3:16 pm
Location: Sweden

Post by Syranide »

by FTP you mean via a PHP-script? or am I missing something... or do you really mean by FTP?
because how can you know if they work if you don't have a tempname for them (to know where they are?).
mikebr
Forum Contributor
Posts: 243
Joined: Sat Sep 28, 2002 7:05 am

Post by mikebr »

When I mentioned ftp I was refering to an ftp client and not an ftp script, using an ftp client the movies play OK so they have content and are not size '0'.

The script I am using is a standard html/php image upload script, this is where I am not getting the $_FILE() array values as expected.

Thanks
Syranide
Forum Contributor
Posts: 281
Joined: Fri May 20, 2005 3:16 pm
Location: Sweden

Post by Syranide »

okok, as I thought then, well, I'm sorry, I'm out of leads for now...
try fiddeling with other filetypes, and smaller sizes.
User avatar
phpScott
DevNet Resident
Posts: 1206
Joined: Wed Oct 09, 2002 6:51 pm
Location: Keele, U.K.

Post by phpScott »

the only thing I can suggest is to try $_FILES['userfile']['error'] as documented on
http://www.php.net/features.file-upload

there is also a link for possible error codes.

It might help explain what is going on.
Post Reply