uknowho008 Posted January 9, 2007 Share Posted January 9, 2007 im using php to upload videos in wmv and mpg format to my webserver. it all seems to work fine until i upload certain wmv's. some work and some dont. for some reason for certain wmv's its as if there was no post at all. i tried echoing the file type just to see what would come up and for the videos that work is would come up with video/ms-wmv or whatever but for the ones that dont seem to work it doesnt do anything. it doesnt even seem to post anything through the html form. does anybody have a clue as to why this could be happening? im completely stumped. Quote Link to comment Share on other sites More sharing options...
magic2goodil Posted January 9, 2007 Share Posted January 9, 2007 code code code? Quote Link to comment Share on other sites More sharing options...
uknowho008 Posted January 9, 2007 Author Share Posted January 9, 2007 its kinda difficult because there in functions and its kind of a mess. but heres what i can do.function VideoUploadForm() { $Page = $_SERVER["REQUEST_URI"];echo <<<HTML <table> <tr><th>Videos</th></tr> <tr><td><form method="post" action="$Page" enctype="multipart/form-data"> Title: <input type="text" name="Title"></td></tr> <tr><td>Downloadable: Yes <input type="radio" name="Down" value="1"> No <input type="radio" name="Down" value="0" checked></td></tr> <tr><td>HTML; SelectBox(Interests, Title, "", "WHERE MediaAllowed=1");echo <<<HTML </td></tr> <tr><td><textarea class="about_me" name="Body"></textarea></td></tr> <tr><td><input class="input" type="file" name="File" /></td></tr> <tr><td><center><input type="submit" name="SubmitVideo" value="Submit" /></center></form></td></tr> </table>HTML;}goes to the same page where this isif(IsSet($_POST["SubmitVideo"])) { SubmitVideo();} else { VideoUploadForm();}function SubmitVideo() { $Title = PostClean("Title"); $Cat = PostClean("InterestsTitle"); $Body = PostClean("Body"); $Down = PostClean("Down");echo $_FILES["File"]["type"];/* if(!$Title OR !$Cat OR !$Body OR !$_FILES["File"]["type"]) { echo "Your missing some information."; VideoUploadForm(); } elseif($_FILES["File"]["type"] == ("video/mpeg" OR "video/mpg" OR "video/mpe" OR "video/x-msvideo" OR "video/avi" OR "video/x-ms-wmv")) { $Me = $_SESSION["Me"]; $Date = mktime(); $Rand = Rand(); $url = "$Me" . "n" . "$Rand" . "n" . $_FILES['File']['name']; copy ($_FILES['File']['tmp_name'], "post_media/$url") or die ("Could not copy"); $insert_sql = " INSERT INTO Posts(Type, UserID, Category, Title, Body, Date) VALUES ('5', '$Me', '$Cat', '$Title', '$Body', '$Date') "; mysql_query($insert_sql) or die("Bad query"); $PostID = mysql_insert_id(); $insert_sql = " INSERT INTO PostMedia(PostID, Type, URL, Download) VALUES ('$PostID', '5', '$url', '$Down') "; mysql_query($insert_sql) or die("Bad query"); redirect("videos.php?ID=$PostID"); } else { echo "Videos must be in mpeg or wmv format"; VideoUploadForm(); }*/}the code for video upload is in quotes because i added the echo file type to see what it is outputing and it just sends me back to the upload form. thanks Quote Link to comment Share on other sites More sharing options...
magic2goodil Posted January 9, 2007 Share Posted January 9, 2007 and this code works fine without basename() around your $_FILES['']['name'] ? Quote Link to comment Share on other sites More sharing options...
uknowho008 Posted January 9, 2007 Author Share Posted January 9, 2007 yeah, for all but some random wmv files. its worked for everything. Quote Link to comment Share on other sites More sharing options...
magic2goodil Posted January 9, 2007 Share Posted January 9, 2007 ummm..jesi? lol Quote Link to comment Share on other sites More sharing options...
uknowho008 Posted January 9, 2007 Author Share Posted January 9, 2007 weird huh? whats the purpose of basename()? Quote Link to comment Share on other sites More sharing options...
magic2goodil Posted January 9, 2007 Share Posted January 9, 2007 with the name and not the tmp_name it gives you jsut the base..so say it was C:\system\blah\myfile.ext it would give you myfile.ext if i am correct...although i may have no idea wth i am talking about Quote Link to comment Share on other sites More sharing options...
uknowho008 Posted January 9, 2007 Author Share Posted January 9, 2007 oh ok, i should have just looked it up but my brain is dead from trying to figure this crap out. Quote Link to comment Share on other sites More sharing options...
uknowho008 Posted January 10, 2007 Author Share Posted January 10, 2007 does anybody have any ideas? im still stumped. Quote Link to comment Share on other sites More sharing options...
fert Posted January 10, 2007 Share Posted January 10, 2007 you're probably going over the max amount of memory PHP can use Quote Link to comment Share on other sites More sharing options...
uknowho008 Posted January 10, 2007 Author Share Posted January 10, 2007 can i fix that in the ini file? i dont remember exactly where it is on the server. Quote Link to comment Share on other sites More sharing options...
fert Posted January 10, 2007 Share Posted January 10, 2007 you can fix it in the ini file Quote Link to comment Share on other sites More sharing options...
Jessica Posted January 10, 2007 Share Posted January 10, 2007 or use ini_set() Quote Link to comment Share on other sites More sharing options...
uknowho008 Posted January 10, 2007 Author Share Posted January 10, 2007 cool thanks, ill try and figure it out. Quote Link to comment Share on other sites More sharing options...
uknowho008 Posted January 10, 2007 Author Share Posted January 10, 2007 is it memory_limit? it was set lower than the video. but i fixed it and its still not working. Quote Link to comment Share on other sites More sharing options...
uknowho008 Posted January 10, 2007 Author Share Posted January 10, 2007 i also set the limit for file upload and post limit. still not working. Quote Link to comment Share on other sites More sharing options...
fert Posted January 10, 2007 Share Posted January 10, 2007 restart apache Quote Link to comment Share on other sites More sharing options...
uknowho008 Posted January 10, 2007 Author Share Posted January 10, 2007 still no luck :( there is only one php.ini right? it must be the size because i tried a mpg of around 55mb the same as the wmv and it didnt work either. Quote Link to comment Share on other sites More sharing options...
uknowho008 Posted January 10, 2007 Author Share Posted January 10, 2007 does anybody upload files > 20mb with php efficiently? or should i use something else? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.