SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    SitePoint Member
    Join Date
    May 2004
    Location
    Malaga, Spain
    Posts
    24
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

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

    Totally stumped on this, I have a standard html/php script that uploads images "without any problem" but when trying to upload movies it all goes pear shaped.

    I need the value of $_FILES['file']['tmp_name'] to move the uploaded movie..

    PHP Code:
    if (move_uploaded_file($_FILES['file']['tmp_name'] ,$file_path.$new_file_name)) 
    but ($_FILES['file']['tmp_name'] >= none

    If I use print_r($_FILES['file']); on a .flv movie then the ouput is:

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

    I have tried various .flv movies and mp4 movies but the result is the same, no tmp name and no size, yet the movies are between .5 Mb and 2.5Mb, these all play fine so they have content.

    Has anyone any idea as to what's going on here?

  2. #2
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,692
    Mentioned
    20 Post(s)
    Tagged
    3 Thread(s)
    mike,

    I've got an animated GIF/SWF upload and the only difference between our codes is that you used:

    if (move_uploaded_file($_FILES['file']['tmp_name'], $file_path.$new_file_name))

    and I used:

    if (move_uploaded_file($_FILES['banner']['tmp_name'], "../adimages/$filename"))

    It looks like the only difference is that I added the $filename within the double quotes whereas your $file_path MUST terminate in "/".

    If that's already done, try adding the double quotes around "$file_path . $new_file_name" and see if that doesn't resolve the problem.

    The only other thought I have on the matter is that the mp3, etc, mime types may need to get defined but I wouldn't think that should be necessary.

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator

  3. #3
    SitePoint Member
    Join Date
    May 2004
    Location
    Malaga, Spain
    Posts
    24
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There is no problem if I try to upload a .gif, .jpg, or .swf, the problem seems to be with movies, i.e. .flv and .mp4 or .mov (I need to upload .flv).

    All the array values of $_FILE() have values when uploading images but with movies the 'file_size' value = '0' and 'file_temp_name' = 'none', so I also can up load gif/swf files but not .flv?


    Thanks

  4. #4
    SitePoint Guru aamonkey's Avatar
    Join Date
    Sep 2004
    Location
    kansas
    Posts
    953
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    does $_FILES['file']['error'] show anything?

  5. #5
    SitePoint Member
    Join Date
    May 2004
    Location
    Malaga, Spain
    Posts
    24
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Tried this, it returns nothing at all.

  6. #6
    SitePoint Guru aamonkey's Avatar
    Join Date
    Sep 2004
    Location
    kansas
    Posts
    953
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    can you post the html form you are using for the upload?

  7. #7
    SitePoint Member
    Join Date
    May 2004
    Location
    Malaga, Spain
    Posts
    24
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Here it is...
    HTML Code:
    <html>
    <head>
    <title>Movie Upload</title>
    </head>
    <form action="../php-bin/inc_movie_upload.php" method="post" enctype="multipart/form-data" name="upload ">
    
    <body topmargin=0 leftmargin=0 marginheight=0 marginwidth=0 bgcolor="#ffffff">
    <div id="LayoutTable">
    
    <table border=0 cellspacing=0 cellpadding=0 width=524>
    	<tr valign=top>
    		<td></td>
    		<td height=12></td>
    	</tr>
    	<tr valign=top>
    		<td>
    		<table border=0 cellpadding=0 cellspacing=0>
    			<tr>
    				<td height=25 width=522 colspan=3 valign=middle bgcolor="#ffffff">
    				<p><span class="verdana12blackBold">Client:<? print "$client"; ?></span><span class="verdana12blackBold"> </span></p></td>
    			</tr>
    			<tr>
    				<td height=15 width=100 valign=top>
    				<p class="right"><span class="verdana11blackBold2"> Current movie: </span></p></td>
    				<td width=14 valign=top><img src="../Resources/_clear.gif" border=0 width=1 height=1 alt=""></td>
    				<td width=408 valign=top>
    				<p><span class="verdana11black">Movie:<? print "$movie"; ?></span><span class="verdana11black"></span></p></td>
    			</tr>
    			<tr>
    				<td height=20 width=100 valign=top>
    				<p class="right"><span class="verdana11blackBold">  Movie</span><span class="verdana11blackBold2"> path:</span></p></td>
    				<td width=14 valign=top><img src="../Resources/_clear.gif" border=0 width=1 height=1 alt=""></td>
    				<td width=408 valign=top>
    				<p><span class="verdana11blackBold2"> <input type="hidden" name="MAX_FILE_SIZE" value="199000">
    <input type="file" name="file"><br />
    
    
    </span><span class="verdana11blackBold2"> </span></p></td>
    			</tr>
    			<tr>
    				<td height=20 width=100 valign=top><img src="../Resources/_clear.gif" border=0 width=1 height=1 alt=""></td>
    				<td width=14 valign=top><img src="../Resources/_clear.gif" border=0 width=1 height=1 alt=""></td>
    				<td width=408 valign=top>
    				<p><input type=submit value="Upload Image"></p></td>
    			</tr>
    		</table>
    		</td>
    		<td height=80></td>
    	</tr>
    	<tr>
    		<td width=522><img src="../Resources/_clear.gif" border=0 width=522 height=1 alt=""></td>
    		<td width=2 height=1><img src="../Resources/_clear.gif" border=0 width=2 height=1 alt=""></td>
    	</tr>
    </table>
    </div>
    </body>
    </html>
    This does of course upload images to the 'upload' script without problems, it is .flv movies where I have the problems.

    Thanks

  8. #8
    SitePoint Guru aamonkey's Avatar
    Join Date
    Sep 2004
    Location
    kansas
    Posts
    953
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This doesn't explain why $_FILES['file']['error'] isn't returning anything, but you have your MAX_FILE_SIZE set too low--it is currently set at about 194kb (199000 bytes) which is too small for the .5MB files you are trying to upload.

    You also have your <form> tag set before your <body> tag which may be causing some problems.

  9. #9
    SitePoint Member
    Join Date
    May 2004
    Location
    Malaga, Spain
    Posts
    24
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by aamonkey
    This doesn't explain why $_FILES['file']['error'] isn't returning anything, but you have your MAX_FILE_SIZE set too low--it is currently set at about 194kb (199000 bytes) which is too small for the .5MB files you are trying to upload.
    I don't beleive it, this was the problem, I never noticed that I had this set too low, changing it to 4999000 sorted the problem.

    Thanks for your time and help.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •