temporary-files

Heroku Ephemeral filesystem and temporary files

ε祈祈猫儿з 提交于 2019-12-01 07:44:03
问题 As I understand Herokus Ephemeral filesystem will only allow you write access to a temporary folder. Created files in that folder will be discarded when the dyno the files was created with is stopped or restarted. What I don't understand is what happens if the dyno is not stopped or restarted? Will files still be discarded after a certain time? We are currently building a system that generates pdf files and forwards them via mail (or you can download the file). Do I need to remove the pdf

rails - x-sendfile + temporary files

余生长醉 提交于 2019-12-01 03:48:17
Some time ago I wrote a question regarding the use of temporary files within a rails app. On thar particular case, I decided to use tempfile This causes a problem if I also want to use the x-sendfile directive ( as a parameter in Rails 2, or as a configuration option in Rails 3 ) so that the file sending is handled by my web server directly, not my rails app. So I thought about doing something like this: require 'tempfile' def foo() # creates a temporary file in tmp/ Tempfile.open('prefix', "#{Rails.root}/tmp") do |f| f.print('a temp message') f.flush send_file(f.path, :x_sendfile => true) #

Eliminating temporary ASP.Net Files

微笑、不失礼 提交于 2019-12-01 03:33:27
How do you prevent ASP.NET from creating too many temporary files? My website creates gigabytes of temporary files, and that overflows the main partition on the server. How do I prevent this from happening? Setup a task in the task scheduler to clean up temporary files. I have no idea why this is not done by the OS (or by the creator of those files). Where are these temp files beeing generated? If it's in the "Temporary ASP.NET Files" folder, it's a result of your application beeing recompiled. Checkout MSDN for more information on dynamic compilation. One possible solution could be to

tmpnam warning saying it is dangerous

≡放荡痞女 提交于 2019-12-01 02:09:20
I get this warning saying that tmpnam is dangerous, but I would prefer to use it, since it can be used as is in Windows as well as Linux. I was wondering why it would be considered dangerous (I'm guessing it's because of the potential for misuse rather than it actually not working properly). Scharron From tmpnam manpage : The tmpnam() function generates a different string each time it is called, up to TMP_MAX times. If it is called more than TMP_MAX times, the behavior is implementation defined. Although tmpnam() generates names that are difficult to guess, it is nevertheless possible that

rails - x-sendfile + temporary files

独自空忆成欢 提交于 2019-12-01 00:53:08
问题 Some time ago I wrote a question regarding the use of temporary files within a rails app. On thar particular case, I decided to use tempfile This causes a problem if I also want to use the x-sendfile directive (as a parameter in Rails 2, or as a configuration option in Rails 3) so that the file sending is handled by my web server directly, not my rails app. So I thought about doing something like this: require 'tempfile' def foo() # creates a temporary file in tmp/ Tempfile.open('prefix', "#

Eliminating temporary ASP.Net Files

感情迁移 提交于 2019-11-30 23:52:59
问题 How do you prevent ASP.NET from creating too many temporary files? My website creates gigabytes of temporary files, and that overflows the main partition on the server. How do I prevent this from happening? 回答1: Setup a task in the task scheduler to clean up temporary files. I have no idea why this is not done by the OS (or by the creator of those files). 回答2: Where are these temp files beeing generated? If it's in the "Temporary ASP.NET Files" folder, it's a result of your application beeing

tmpnam warning saying it is dangerous

人走茶凉 提交于 2019-11-30 21:33:23
问题 I get this warning saying that tmpnam is dangerous, but I would prefer to use it, since it can be used as is in Windows as well as Linux. I was wondering why it would be considered dangerous (I'm guessing it's because of the potential for misuse rather than it actually not working properly). 回答1: From tmpnam manpage : The tmpnam() function generates a different string each time it is called, up to TMP_MAX times. If it is called more than TMP_MAX times, the behavior is implementation defined.

How to get a temporary file path?

为君一笑 提交于 2019-11-30 13:41:33
问题 I know you can create a temporary file with tmpfile and than write to it, and close it when it is not needed anymore. But the problem I have is that I need the absolute path to the file like this: "/var/www/html/lolo/myfile.xml" Can I somehow get the path, even with some other function or trick? EDIT: I want to be able to download the file from the database, but without $fh = fopen("/var/www/html/myfile.xml", 'w') or die("no no"); fwrite($fh, $fileData); fclose($fh); because if I do it like

How to get a temporary file path?

旧巷老猫 提交于 2019-11-30 08:09:13
I know you can create a temporary file with tmpfile and than write to it, and close it when it is not needed anymore. But the problem I have is that I need the absolute path to the file like this: "/var/www/html/lolo/myfile.xml" Can I somehow get the path, even with some other function or trick? EDIT: I want to be able to download the file from the database, but without $fh = fopen("/var/www/html/myfile.xml", 'w') or die("no no"); fwrite($fh, $fileData); fclose($fh); because if I do it like this, there is a chance of overlapping, if more people try to download the same file at exactly the same

how to use tempfile.NamedTemporaryFile() in python

◇◆丶佛笑我妖孽 提交于 2019-11-30 01:19:51
I want to use tempfile.NamedTemporaryFile() to write some contents into it and then open that file. I have written following code: tf = tempfile.NamedTemporaryFile() tfName = tf.name tf.seek(0) tf.write(contents) tf.flush() but I am unable to open this file and see its contents in notepad or similar application. Is there any way to achieve this? Why cant I do something like: os.system('start notepad.exe ' + tfName) at the end This could be one of two reasons: Firstly, by default the temporary file is deleted as soon as it is closed . To fix this use: tf = tempfile.NamedTemporaryFile(delete