Edit word doc using webDAV - webdav

I am using webDAV and able to open the word file from server side. When I make some changes and save it, it is unable to save it on server and instead asking to save it on local. When I select to save it to web address it hits the webdavservlet but still it does not save it and ask to save locally.
Is there anything I am missing, is there any head or param that needs to be set. Or we need to call put method in webdav servlet, if yes how that can be made from ms-word when saved?
Thanks

Related

Unable to delete uploaded XML file on Drupal 8.5

I have created a media type that accepts XML files and saves them to a custom publicly accessible location on the server.
Ideally I would like the file to be overwritten when the exact same file is uploaded. This does not happen, instead it creates a new file and adds a number on the end. I have "Create new Revision" turned off.
To get around this issue I thought I could just delete the file via the CMS. The uploaded file has status of "Permanent" and is used 0 places. I know the cron job cleans up files for you, but when I run the cron the file in question is still there. I figure it's because the file is set to permanent, but I don't see a way to flip this to temporary.
Any help is much appeciated.
There is a setting nested away in the file system settings, which lets you configure it to remove (or not removed) orphaned files. If drush isn't removing them despite having no usages recorded, I'd check this option isn't ticked.
The temporary and permanent status are used for storing temporary files during the upload/save process, so I wouldn't tinker with those too much.
If you fancy making the form yourself using the form API, then you can save the file programmatically using the FILE_EXISTS_REPLACE parameter.
https://api.drupal.org/api/drupal/core%21modules%21file%21file.module/function/file_save_data/8.5.x

Force file download in a browser using ASP.Net MVC when the file is located on a different server without downloading it on my server first

Here's what I would like to accomplish:
I have a file stored in Windows Azure Blob Storage (or for that matter any file which is not on my web server but accessible via a URL).
I want to force download a file without actually downloading the file on my web server first i.e. browser should automatically fetch the file from this external URL and prompts the user to download it.
Possible Solutions Explored:
Here's what I have explored so far (and why they won't work):
Using something like FileContentResult as described here Returning a file to View/Download in ASP.NET MVC to download the file. This solution would require me to fetch the contents on my server and then stream from my server to the browser. For this reason this solution won't work.
Using HTML 5 download attribute: HTML 5 download attribute would have worked perfectly fine however the problem is that while it is really a very neat solution, it is not supported in all browsers.
Changing the file's content type: Another thing I could do (at least for the files that I own) to change the content type property of the file to something that the browser wouldn't understand and thus would be forced to download the file. This might work in some browsers however not in all as IE is smart enough to go beyond the content type and sees the file's content to determine the content type. Furthermore if I don't own the files, then I won't have access to changing the content type of the file.
Simply put, in my controller action I should be able to specify the URL of the file and somehow browser should force download the file.
Is this something which can be accomplished? If yes, then any ideas how I could accomplish this?
Simply put, in my controller action I should be able to specify the URL of the file and somehow browser should force download the file [without exposing the URL of the file to the client].
You can't. If the final URL is to remain hidden, your server must serve the data, so your server must download the file from the URL.
Your client can't download a file it can't get the URL to.
You can create file transfer WCF service (REST) which will stream your content from blob storage or from other sources through your file managers to client browser directly by URL.
https://{service}/FileTransfer/DownloadFile/{id, synonym, filename etc}
Blob path won't be exposed, web application will be free from file transfer issues.

Get file path & filename with asp:FileUpload, don't want file... just path and name

I am developing a .NET intranet site which will enable the user to see a list of files (file details stored in DB) and link to the actual PDF/XML/XLS and open it... kind of like a table of contents for the network.
During data entry, the user enters various data about a document, then browses to the file on the network and selects it using the asp:FileUpload. The codebehind then saves the network path to the DB. There is alot of overhead here because i'm sending the file to the server but never use it.
Everything has been working fine until someone tries to use a large PDF file then I get the dreaded MAXIMUM REQUEST LENGTH EXCEEDED error... So I'm trying to find a solution here... I do not need the actual file.. just the path and filename.
I know not all browsers send the full path but our systems have older browsers so everything is working fine now, but will probably break soon.. which is another reason to find a different solution.
I've looked into Javascript to pull the path but that won't work...
Any other ideas? Other ways to just grab the path and filename? (besides manually typing it in to a Text field)
Thanks,
Todd.
This may help too
How to get the full path of a file from asp: file upload?
string filename = Path.GetFileName(FileUpload1.FileName);//file name
string path= Server.MapPath(filename);//path

How to execute custom Alfresco script on saving document opened via WebDAV or CIFS?

I want to open an Excel file to edit offline via WebDAV or CIFS and run my script at the Alfresco side to parse the content of the file when user saves a workbook.
Is it possible? How can I do this?
Use a content rule for inbound/updated documents. This way, regardless of which interface the user leverages to access documents (HTTP/WebDAV/CIFS/FTP) the rule will be triggered, and you can set it to "Execute Script" as an outcome.

Deleting Application Temp File from ASP.Net

I have a WebPage where I am giving the option to to Export the Form data to PDF. I am creating the PDF at run time and store the PDF in a "PDF" folder which is under my application directory. After creating the PDF with the SessionID name I Call following function to show the PDF file in the new browser window:
ResponseHelper.Redirect(Response, "~/PDF/" + Session.SessionID + ".pdf", "_Blank", "");
This PDF contains the private information related to the logged in user. Therefore, I want a way to delete this PDF file once it is shown in the browser to the user. This is because the IIS server allows whole development team to view this folder which is a security risk, and we can't disallow user to view this folder on the server.
Therefore, if I could delete this file as soon as it is loaded in the browser could be a solution of this security risk.
Can anyone suggest some better ways of deleting this file as soon as possbile from the application?
Thanks,
Praveen
what i guess is you are creating PDF file on runtime using Itext and then you save that PDF file in temp directory to show it to user... why don't you use
Response.WriteFile(PDFFILE);
this will write the whole file on the stream without saving it in temp folder.
One way is to write an ashx handler which streams the pdf to the browser, then deletes it when done.
Another, and much better way, is to simply build the PDF in memory (NOT using session) and stream it as soon as it's ready.
UPDATE
I'm doing this with a slightly modified version of iTextSharp. Basically, iTextSharp performed all of it's operations in memory, then saved the file to disk. I changed this to return the memory stream. All the code is already there, it was really just a line or two that had to change.
Then, I used a response.binarywrite to push the stream directly to the browser. viola! no files on disk.
An ashx handler is just like an aspx page, only it has one entry point and doesn't do all of the page processing garbage. It's light weight and communicates back to the browser by response.write calls.

Resources