V
Venkat Bagam
Hi folks,
I have been facing problem while writing data to a temporary
file.
I have the following code on my ubuntu machine:
1. encrypted_content = @crypto_key.encrypt(attachment.read)
2. tmpFile = Tempfile.new("encrypted_file")
3. tmpFile.write("#{encrypted_content}")
4. # i tried this too tmpFile.write(encrypted_content)
5. tmpFile.flush
After executing this code, I could only find an empty temporary file
under tmp/ directory in my file system. Why didn't my code write the
content into my tmpFile?
when I replaced line 3 with the following: tmpFile.write("hello world
!"), I could find the "hello world !" in my tmpFile. What could be the
reason? Did I go wrong any where? Any help appreciated
regards,
Venkat.
I have been facing problem while writing data to a temporary
file.
I have the following code on my ubuntu machine:
1. encrypted_content = @crypto_key.encrypt(attachment.read)
2. tmpFile = Tempfile.new("encrypted_file")
3. tmpFile.write("#{encrypted_content}")
4. # i tried this too tmpFile.write(encrypted_content)
5. tmpFile.flush
After executing this code, I could only find an empty temporary file
under tmp/ directory in my file system. Why didn't my code write the
content into my tmpFile?
when I replaced line 3 with the following: tmpFile.write("hello world
!"), I could find the "hello world !" in my tmpFile. What could be the
reason? Did I go wrong any where? Any help appreciated
regards,
Venkat.