-2

I am trying to create a file upload to enable users to save .txt files to my website, however the file contents need to either be updated every Nth second OR streamed from the user's desktop for live changes.

I would prefer this to run using PHP as i am more familiar with it than say JavaScript, however i am open to all suggestions.

Script47
  • 14,230
  • 4
  • 45
  • 66
  • 1
    Awesome! So what is your actual question/issue? You do realise SO isn't a code writing service? You need to show us your attempt and we'll help you fix your errors. – Script47 Aug 29 '17 at 08:59
  • Well, at the minute i have just a standard file upload form that saves "test.txt" to a folder. I have tried to loop that upload, however it doesnt refresh the data when the file is edited on the user's side. I need it to update the uploaded "test.txt" with the information from the user's "test.txt" file, without them needing to re-upload the file each time. – Alex Drinkhill Aug 29 '17 at 10:31

1 Answers1

0

Use curl, which you can install locally. You can send the file using a command like in the following example

curl -X POST -F 'datafile=@/home/me/Desktop/datafile.txt' http://mywebsite.com/upload.php

This will come to your PHP script as data

Array(
  "datafile": array(
    "name" => "datafile.txt"
    "type" => "text/plain",
    "tmp_name" => "/tmp/file/on/your/webserver/phpyh7g63j",
    "error" => 0,
    "size" => 12345
  )
)
crafter
  • 6,246
  • 1
  • 34
  • 46