531joshua Posted March 3, 2008 Author Report Share Posted March 3, 2008 (edited) <?php $ext = array_pop(explode(".",basename($_FILES['Filedata']['name']))); ?>I've tested that out and it's of the same secure level as using the mime type I'd say. I renamed a .JPEG image as .MPEG and it returned .MPEG as the file extension.Also, the problems I was having with the .mp4 files was something to do with the file being wierd. I checked it by uploading it via FTP to my site, then whenever me or anyone else tries to play it after downloading it, doesn't matter what program or plugin you have it just says there's an error with the file.Wierd though, because it plays fine in most players if I tansfer it straight from my external device to my PC. It's just when it's uploaded to another web server and downloaded that it has problems.EDIT: I've been thinking... lets say I get my image file (.JPEG), right click on it and click edit, open it in paint, save it as "new_file.MPEG"... doesn't that mean I've totally changed the formatting of the file (or something like that), so it's not really an image any more? So basically, if someone saved their .exe file as .mpeg, uploaded it to my public file on my server, they couldn't open it as a .exe file? Because the file format is still .mpeg, so the browser and OS just think it's a video or whatever?Really confused over this now ha. Edited March 4, 2008 by 531joshua Quote Link to comment Share on other sites More sharing options...
531joshua Posted March 5, 2008 Author Report Share Posted March 5, 2008 http://swfupload.org/documentation/demonstrationWhich one have you used for ttVideo? I checked out the javascript on the upload page, and it seemed to be very similar to that of the "application" demo... But that only works for images, as it generates the image thumbnails etc.Noticed the change from TrialsTube to ttVideo, Youtube been pestering? Quote Link to comment Share on other sites More sharing options...
tomturd Posted March 5, 2008 Report Share Posted March 5, 2008 http://swfupload.org/documentation/demonstrationWhich one have you used for ttVideo? I checked out the javascript on the upload page, and it seemed to be very similar to that of the "application" demo... But that only works for images, as it generates the image thumbnails etc.Noticed the change from TrialsTube to ttVideo, Youtube been pestering?I used the classic forms demo. It took me about 6 hours to get the demo working - so good luck with it ttVideo is just the default name that I released the mod under so every time I upgrade it I have to change it back to TrialsTube. Quote Link to comment Share on other sites More sharing options...
531joshua Posted March 5, 2008 Author Report Share Posted March 5, 2008 Ah right, I'll be on a few weeks in that case.Doesn't Youtube care about you using "TrialsTube", and providing a video sharing service, very similar to theirs? Mind I know there's youporn, pornotube, redtube etc. Still though, I would have thought Youtube would have been tight with that sort of thing. Quote Link to comment Share on other sites More sharing options...
531joshua Posted March 23, 2008 Author Report Share Posted March 23, 2008 I was looking through php.net the other day and I noticed something in the header() function list thingy, it gave an example of using the header() to force the user to download, as you said in a previous post Tom.On php.net they gave a fairly simpler code, which I've used in a script...// Download File Settings if($_GET['action']=="download") { $query = "SELECT * FROM files WHERE id = '".$_GET['id']."'"; $result = mysql_query($query) or die("MySQL Error:".mysql_error()); $row = mysql_fetch_array($result); header('Content-type: application/force-download'); header('Content-Disposition: attachment; filename="'.$row['file_name'].'"'); readfile('home/sites/bikearea.co.uk/files/'.$row['file_name']); }I'm guessing you used a lot of different header() functions to suit different platforms and browsers? Still though, isn't what I've used above fairly universal, so as to be used across a range of platforms / browsers with no hassle? 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.