temporary-files

How to upload files without turning it to temporary file? (NetBeans JSF Primefaces)

与世无争的帅哥 提交于 2019-12-08 03:45:27
问题 Good day to all! I've been making a simple web Application using Netbeans, JSF and Primefaces that can upload .csv, .jpeg/.jpg and .pdf files. I made 2 folders which was stored in drive C: (uploaded folder and tmp folder). I assigned the "uploaded" folder to where the uploaded files are stored and the "tmp" for the .tmp of the uploaded files. I've been through many question threads and video tutorial which I followed correctly. I also downloaded the commons fileupload and commons io and added

Python tempfile.TemporaryFile hangs on Windows when no write privilege

帅比萌擦擦* 提交于 2019-12-07 10:41:50
问题 My environment is Python 3.7.2, running on Windows 10. I'm working on a directory-selection widget, and I'm looking for the cleanest+surest method to test whether the selected directory path allows write privilege. Previously I'd been opening a named file by the usual open() method, writing a few bytes to it, then deleting it -- putting the whole thing in a try-except block. This was OK but it ran the risk of leaving behind an unwanted file. Recently I came across the documentation for

C# Best Practices: Writing “temporary” files for download: Place in applicaion's environment folder or temp folder

£可爱£侵袭症+ 提交于 2019-12-07 07:49:29
问题 Basically, I'm wondering if there is a best practice when it comes to the following issue of downloading files, not just for temporary use, but eventually to move them to the application folder. I'm faced with some options: //Option 1 - Random file String tempfile = Path.GetTempFileName(); WriteData(tempfile); File.Move(tempfile, Path.Combine(Environment.CurrentDirectory, filename); //Option 2 - Temp Path + Random file name String tempfile = Path.Combine(Path.GetTempPath(), Path

Create directory inside NSTemporaryDirectory

无人久伴 提交于 2019-12-07 06:04:21
问题 How can I create a directory inside NSTemporaryDirectory ? I tried something like: [NSTemporaryDirectory() stringByAppendingPathComponent:@"/myTmp/"]; followed by the file name, but it didn't work. 回答1: Use NSFileManager to create the directory for you: [[NSFileManager defaultManager] createDirectoryAtPath:[NSTemporaryDirectory() stringByAppendingPathComponent:@"/myTmp/"] withIntermediateDirectories:YES attributes:nil error:nil]; 来源: https://stackoverflow.com/questions/6847788/create

PHP:: How to delete a file from server after is read. Unlink() is executed before

。_饼干妹妹 提交于 2019-12-07 04:49:59
问题 I'm trying to delete a picture (.jpg) from server after the first time showed. But the file is deleted (unlink();) before showed. I've already tried with sleep() but this only delay the loading and after all the file is deleted before showed. 回答1: You could use mod_rewrite to redirect jpg requests to a script that loads the image into memory, deletes the file, then serves up the image. IMO, this is the simplest and easiest solution. Unsafe example below... Example .htaccess file: # Turn on

WIX: Using a temporary file during install

我与影子孤独终老i 提交于 2019-12-07 00:13:33
问题 I am writing a WIX installer and I have a following requirement: During installation, I need to pass an absolute path to a file (lets call it A) included in my installer to a COM component, which already exists on the hard drive and is a part of another program. I have already written an appropriate Custom Action which expects a path to the file A. I don't want to include A as a file installed in the Program Files folder and removed during the uninstallation process. Instead, I would like to

How to get a temporary file name?

余生长醉 提交于 2019-12-06 17:29:05
问题 I've seen some posts relating to my question, but none that address it completely. I need to create a file in the standard temporary directory and after I'm done writing to it, move it to a different location. The idea is that the file is considered temporary while being downloaded and permanent after downloading completes. I'm attempting this by calling either mkstemp or tmpfile, then rename after I'm done writing to it. However, I need the full path of the file to call rename, and

php - Create file from string and attach to email

痞子三分冷 提交于 2019-12-06 16:44:18
I have an application in which users can send me feedback. When they do this, various data from their system is posted to a php file on my server. The php file then handles that data and sends me an email with that data via mail(). Right now, all of the data is just composed into an HTML email. What I want to do is take some of the posted data, convert them to files, and add them as attachments to the email. I know how to add files as attachments with mail(). I just can't think of a way to create the files first. I thought of just using fopen() and fwrite(), but then what if two users are

File upload with WinSCP .NET/COM with temporary filenames

≡放荡痞女 提交于 2019-12-06 03:37:43
问题 I am creating a small .NET application in C# to upload files to an FTP Server. I am using the .NET DLL for WinSCP while doing this and i have been trying to find a good solution to my problem. The FTP folder where I will put all my files will be monitored by another application. This application will then take these files and process them automatically. So what I want to avoid is that my files are grabbed by the application before the transfer is complete. So I want to use either temporary

Virus scanners locking and deleting temporary files - best way to cope with them?

吃可爱长大的小学妹 提交于 2019-12-06 02:01:00
问题 My application deals with e-mails coming from different sources, e.g. Outlook and IMAP mailboxes. Before parsing them, I write them to the temporary directory (keeping them in memory is not an option). While parsing, I might be writing attachments to the temp directory (for example, if they are too large to keep in memory or for full-text extraction). But in the wild, two things happen that seemed very strange in the first place but could all be traced back to virus scanner behaviour: I'm