Save uploaded file in 2 extentions php - php

I want to let my users upload a video (and after uploading watching it). The video is saved on the server. However, to let every user watch the video with <video>, I have to make sure I offer the video in 2 extensions, namely .ogg and .mp4 see www.w3schools.com.
how do I save the same file twice, but with different extensions, and how to convert them to the other extension in php?
I thank you for your time.

Related

Create and download a zip with multiple files without saving the zip file on the server (PHP and laravel)

I have several files on my Laravel server. I can already download each of them individually. However I would like to compress many files into a zip file and just download the zip file.
I know I can create a new zip file in my database and add all the files, but I prefer not to keep the zip file on the database, as it would occupy too much space.
Ideally the server would create the zip file when the user clicks on the button on the User Interface (website) and download it without storing it on the server.
A possible solution would be to store the zip and delete it after 10 minutes, for example, but I can't be sure if it has already been downloaded.
Can you think of a better way to do this?

S3 video uploader, file not transcoding

I've recently pushed a video uploader for this website I've been working on for months. Recently, we have had two separate instances where the video the user uploaded wasn't completely uploaded resulting in a broken file that wont play. Currently, we are not sure as to why something like is occurring, but we have a couple of hunches, namely the files that are being uploaded are too big to handle and the user's upload speed is horrible. I was wondering what I can do to handle situations such as these where the upload conditions are less than optimal.
I upload firstly to the tmp directory on my Linux server then move the file to S3, our system is for end users to upload and we limit files to 40GB.

Run a upload in background with base64 file

I work with radiology medical reports. Doctors record the report in a audio file and close the browser after this, so the browser doesn't have time to upload the file. I tried to put a loading with a warning about the time to upload and the need to stay with browser open, but they don't respect it and the accuracy of loading screen is not very correct.
My question is: since I have a audio file encoded in base64, there is a way to run this upload in background or keep this to upload in another screen request?
My point is, there is a way to upload the files without any dependency of the user?
If it helps, I`m using CodeIgniter.
Thanks

how does youtube convert videos to mp4/flv when uploading the video

Hi i'm making a site in wordpress using a theme called wptube2 and it has all the Youtube look and stuff but what I need is that when I upload some video it just uploads I want it to be able to change it format to like MP4 and be published in my own player like jwplayer but I don't know where to start any suggestions would be greatly appreciated I just want to upload any video format and it should automatically be converted it to MP4 and published with jwplayer
here is a screen shot where i publish my videos from!
I used ffmpeg to do all my conversions.
You could make your uploaded video files all go to one central folder. Have a batch file that runs ffmpeg on those files and then move it to the another folder once it is processed.
You could upload your file in whatever format, give it a fake .mp4 file name and just have a message that says "file being processed" in the meantime.
File conversion takes time, and a lot of processing power, be sure to try it locally before even considering making your server do all the work.

Display an image from a ZIP file without extracting it to the server (PHP)

On my site, admins can upload ZIP files that contain a set of JPGs. Users can then download the ZIPs. I also want users to be able to preview images from the ZIP file. But I don't want to extract the images into a temp dir on the server and delete them later.
Is there a way to do this? Perhaps with the img "data:" URI scheme?
One way or another, people would have to download parts of that zip file, so you might as well do some server-side processing and generate thumbnails of the images ONCE. Then just serve up those thumbs repeatedly. Otherwise you're going to waste a lot of cpu time repeatedly extracting images, encoding them for data uris, and sending out those data uris.

Categories