I am gonna to save file when the file is still uploading to the server!
For example, the client uploads a video to the server and I want to get that file and save it when client waits to finish it. in other words, I want to save uploaded file every 100kb.
Maybe you ask me, why I am going to do this! Here is why:
I am creating a video conferencing stream by PHP, I want to save uploading video and get it in another clients device!
Can I use php:// to get that file?
reference
Related
Hi I am wondering if the input field with type "file" is automatically uploading files to the server when there is a file selected by the user.
The thing I want is that a user can select files to submit it and that a PHP FTP connection is established to upload the files.
I am not sure if the browser pre-uploads the files to a temp directory on the server or does it do that only when you hit the submit button?
Because if the file is already uploaded to the server it would be unnecessary to use FTP to upload the file again only to a different location on the server.
Basically what I want to accomplish is something similar to what we transfer does. I believe they are not uploading before the user hits the button.
Can anybody point me in the right direction and provide me with some extra info about this matter. Haven't found the desired information yet.
Thanks in advance.
The file is uploaded only once the form is submitted (in the same HTTP POST request as all other form fields). Why don't you try it, to see yourself?
And you cannot use PHP to upload a file via FTP from a client to a server. That's not possible. PHP runs on the server, it cannot access files on a client's machine. See also:
Upload a local file from application via web server with PHP code to FTP server
PHP uploading file from browser to FTP.
I know for the fact that there is trojan or malware in php which represents itself as an image. And I also know that to filter out the file upload we use extensions such as .txt or .png.
Is there a way to scan the files manually when they are being uploaded into the server using server built-in antivirus or the server doing this kind of tasks automatically for us? ( I mean particularly in cpanel )
thanks
If you are worried about code being uploaded to your server in the form of an image, simply re-encode the image upon upload. A file containing code with an image extension will throw an error when the encoder tries to process it.
I'm using Blueimp jQuery File Upload with chunked uploads to handle large files, and everytime file upload are completed or file are removed, I update the client's disk space used in database.
My problem is: when the upload process is interrupted, I just can delete incomplete file from client-side by using fail callback to send a DELETE request to server, like this guide : https://github.com/blueimp/jQuery-File-Upload/wiki/Chunked-file-uploads#deleting-aborted-chunked-uploads.
But if clients' internet connections has been lost or the browser is closed, the server will not get any request, there's no update in database too, and the corrupted file still exists. When the client re-connects to the site and remove file, it will cause wrong amount of disk space used in database.
Is there any way to remove imcomplete file of chunked upload from server-side or another solution for my case ? Please help me.
So, I'm creating an FTP client using PHP.
What I want is, if the upload fails (timed out, connection error, etc.), it will try to upload the file again in 1 minute, and if it fails again then try in 10 minuts, until it reached the maximum time to upload the file.
Let's say I have these files in my local folder:
File1.ext, File2.ext, File3.ext. And I successfully uploaded File1.ext and File3.ext. I should reupload the File2.ext, how should I do it? Any ideas?
I am running my script in the background using exec(), and if the upload is done, it will send me an email regarding the process. And I am doing recursive upload, it checks the files in my local folder then upload it one by one then deletes it after uploading.
Thanks!
I am trying to read and write a remote a file to the user's browser through CodeIgniter(FTP Class). That is, I want user to read the file edit the content and save it back.
One way will be
- download the file to my server
- read the file and echo to the user(Browser)
- Save the content of the file to local copy(My server)
- upload the file back to the server
But I don't want to download the file to my server I just want to read and write to remote file
You can write it to the temporary file and after displaying just delete it using unlink() function in the same script. Just call it straight after echoing the content. The file will be present on your server for a really short period of time. FTP is used to upload files, but not for editing them remotely. Any FTP client supporting file edit is actually saving it to the temp folder on your computer and after the edit uploads it back to the server.