Page 1 of 2

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

Posted: Thu Jun 02, 2005 12:29 pm
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

Posted: Fri Jun 03, 2005 1:32 am
by Syranide
same as in another post, MAX_POST_SIZE (or something like that)
all above (default) 4M are discarded.

Posted: Fri Jun 03, 2005 1:46 am
by ol4pr0
Besides that i believe you want to move it.

Code: Select all

move_uploaded_file();
Move Uploaded File

Posted: Fri Jun 03, 2005 2:27 am
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

Posted: Fri Jun 03, 2005 3:02 am
by Syranide
then something is wrong, the size should be there.
EDIT: do a print_r and see what's available.

Posted: Fri Jun 03, 2005 3:33 am
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

Posted: Fri Jun 03, 2005 3:50 am
by Syranide
print_r($_FILES('file')); <-- should be print_r($_FILES['file']);
keep your brackets straight and your parenthesis bent ;)

Posted: Fri Jun 03, 2005 4:33 am
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

Posted: Fri Jun 03, 2005 4:42 am
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...

Posted: Fri Jun 03, 2005 4:45 am
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 )

Posted: Fri Jun 03, 2005 4:50 am
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

Posted: Fri Jun 03, 2005 4:53 am
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?).

Posted: Fri Jun 03, 2005 4:58 am
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

Posted: Fri Jun 03, 2005 5:01 am
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.

Posted: Fri Jun 03, 2005 6:38 am
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.