Open files from website and save back to website

I have a website which uploads files onto my website. I want users to be able to open the file from my website in whatever program they have on their computer. Example they open up a .txt file from my website it opens up on their computer in notepad. When they save the file I want it to save back to my website. I’ve been searching around for hours and I’ve been coming up with “webdav” but cannot figure out how to utilize this. I use Xampp to connect my websites. I see a webdav folder but when I try to upload something through PHP to that folder it says it’s not allowed. Any information would be helpful and please be thorough as this is all new to me.

Personally, i wouldn’t allow that. Its a huge security risk. I would allow them to open it in your site for editing so you can control and validate the input so they can’t upload a virus or something else.

Webdev is a pretty popular thing though, should be documentation on how to use and set it up.

Thanks for the response! The idea is one user could upload the file another download it then reupload. I would like to keep the user from having to choose where to save it and choose it again to reupload. An in-site editor wouldn’t work because I want to allow different types of files like excel and word and pdf ect. Do you know of any alternative ways of doing this? Also I searched and searched about webdav and cant come up with any starting point I understand…

Well, if it is just text, you can just load the text and have them edit it online on your webpage.
Then, when they are done editing the text, they save it by pressing a form button.
The form button can sent it to a PHP script server-side that can strip out tags and such and save it for them.

Richei is very correct in his security comments. If you have a text file on your site, you can just place a link to it and when they select it, it will download the file. Then, they can edit it on their local system… Then, you can create a page on your site that allows them to upload the file to your server using a form. People do upload pictures and docs every day. It is secure if you plan for it. You need to parse their file and remove any programming that is in it.

Direct uploading of files is not secure, but, programmed ones are. Not sure if that helps. Perhaps if you mention more details on what you are uploading, maybe we can help further. I have one site that users upload pictures and text files all the time and never have any issues with it. I do strip out crap from the text files and am very careful what filetypes I allow to be uploaded. Good luck.

Sponsor our Newsletter | Privacy Policy | Terms of Service